Java Problem 6