optimize the JNI input processing