Project Euler in Java