Improve JNI code generation (array truncation)