Project Euler, Problem 19 Java