Project Euler Problem 5 Java