Add the java code for Chapter 2.1
Merge pull request #278 from WangTaoTheTonic/master

Add the java code for Chapter 2.1