Project Euler Problem 3 Java