[JAVA] Minor performance improvement