Add java solution for problem 1