Here you can find the source of concat(ByteBuffer[] buf1, ByteBuffer[] buf2)
public static ByteBuffer[] concat(ByteBuffer[] buf1, ByteBuffer[] buf2)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; public class Main { public static ByteBuffer[] concat(ByteBuffer[] buf1, ByteBuffer[] buf2) { ByteBuffer[] buf = new ByteBuffer[buf1.length + buf2.length]; int j = 0; for (int i = 0, len = buf1.length; i < len; i++) { buf[j++] = buf1[i];//from ww w. j a va 2 s. co m } for (int i = 0, len = buf2.length; i < len; i++) { buf[j++] = buf2[i]; } return buf; } }