Project Euler, Problem 36 Java