Java: moderate prime numbers