Sieve of Eratosthenes implementation in Java