java: problem 3