Project Euler, Problem 15, Java