Java implementation of Rosetta Code's ABC Problem