Solutions for Think Java, How to Think Like a Computer Scientist, 5.1.2