Is want some Java code to read something that was allocated in C++ code. I'm looking for something like this: unsigned char* c = new unsigned char[100]; jbytearray data = JvNewByteArray( c, 100 ); javaObject->fun( data ); delete[] c; I think that in JNI I can do something similiar with NewDirectByteBuffer(). Is there a function in CNI?