Here you can find the source of redByteArray(ByteBuffer buffer, int offset, int length)
public static byte[] redByteArray(ByteBuffer buffer, int offset, int length)
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; public class Main { public static byte[] redByteArray(ByteBuffer buffer, int offset, int length) { byte[] dst = new byte[length]; for (int i = 0; i < length; i++) { dst[i] = buffer.get(offset + i); }//from w ww . j a v a 2s . c om return dst; } }