Project Euler Code in Java