HackerRank Java Loops I problem solution - TheCScience