Project Euler exercises, solving with Java