public static ByteBuffer Get(this ByteBuffer buffer, JavaArray <Byte> dst, int dstOffset, int byteCount) { if (_byteBufferClassRef == IntPtr.Zero) { _byteBufferClassRef = JNIEnv.FindClass("java/nio/ByteBuffer"); } if (_byteBufferGetBii == IntPtr.Zero) { _byteBufferGetBii = JNIEnv.GetMethodID(_byteBufferClassRef, "get", "([BII)Ljava/nio/ByteBuffer;"); } return(Object.GetObject <ByteBuffer>( JNIEnv.CallObjectMethod(buffer.Handle, _byteBufferGetBii, new JValue(dst), new JValue(dstOffset), new JValue(byteCount)), JniHandleOwnership.TransferLocalRef)); }