Added java solution for problem 1