fix(java): narrow JNI byte slice casts (#8603)