Java Hackerrank Certification Solution