HackerRank Java Primality Test problem solution - TheCScience