Added Problem 10 in Java