Java solution to http://projecteuler.net/problem=49