Java examples for java.nio:ByteBuffer
build Byte Buffer
//package com.java2s; import java.nio.ByteBuffer; public class Main { public static ByteBuffer buildByteBuffer(byte[] array) { ByteBuffer byteBuffer = ByteBuffer.allocateDirect(array.length); byteBuffer.put(array);/*from www. java 2s .co m*/ byteBuffer.position(0); return byteBuffer; } }