(java) Solved problem 32