Project Euler, Problem 37 Java