Add Solution To Problem 4 In Java