public static byte[] toArray(ByteBuffer buffer, int size) {
        return toArray(buffer, 0, size);
    }
Read a byte array from its current position given the size in the buffer
@param buffer The buffer to read from
@param size The number of bytes to read into the array
clients/src/main/java/org/apache/kafka/common/utils/Utils.java