Project Euler, Problem 3 Java. But a very inefficient one with String comparison