Here you can find the source of memcpy(ByteBuffer dstBuffer, int dstByteOffset, ByteBuffer srcBuffer, int srcByteOffset, int length)
static void memcpy(ByteBuffer dstBuffer, int dstByteOffset, ByteBuffer srcBuffer, int srcByteOffset, int length)
//package com.java2s; // Licensed under the MIT License: import java.nio.ByteBuffer; public class Main { static void memcpy(ByteBuffer dstBuffer, int dstByteOffset, ByteBuffer srcBuffer, int srcByteOffset, int length) { ByteBuffer dstDup = dstBuffer.duplicate(); dstDup.position(dstByteOffset);//from w ww . j a v a 2 s .co m dstDup.limit(dstByteOffset + length); ByteBuffer srcDup = srcBuffer.duplicate(); srcDup.position(srcByteOffset); srcDup.limit(srcByteOffset + length); dstDup.put(srcDup); } }