update java example code
Merge pull request #2632 from Jonahss/master

update java example code