[Java] Fixed a compile error.
[Java] Fixed a compile error caused in some Java version.
[Java] Fixed some errors in the sample and benchmark code.