(java) Solved problem 28