Project Euler, Problem 4 Java