Add Java code for Chapter 1.5