a little java,a few patterns