Added java solution to problem 1