Added a java solution to problem 1