Part 1 in Java