Project Euler, Problem 32, Java