Solution to ProjectEuler problems using Java