problem 23 with java