fixed up java sample code in docs

fixes #2572
nice catch