(java) Solved problem 33