problem 6 java