Project Euler, Problem 27, Java