fixed up java sample code in docs
Merge pull request #3295 from Jonahss/javasamples

fixed up java sample code in docs