Project Euler done in Java