Convert ByteBuffer to ByteArray (Android)

I would like to convert depthframe from source as below:

VideoFrameRef frame = depthStream.readFrame();
ByteBuffer byteBuf = frame.getData();

byteBuf → byte []?

Where can I find some details on data format on depth byte buffer in Android or do you provide some utils to help with that?

Here an example in Kotlin:

val byteArray = ByteArray(byteBuf.capacity())
byteBuf.get(byteArray)