My attempt to beat Project Euler in java