Added Java solution for problem 1