A simple number generator in Java