Created solution to Challange #2 in Java.