NumberGenerator java example