java: cast arguments passed to JNI