Java answer to problem 9
Simplified ruby sieve code a bit.