[Java] Fixed some errors in the sample and benchmark code.