Project Euler answers in Java