build Byte Buffer - Java java.nio

Java examples for java.nio:ByteBuffer

Description

build Byte Buffer

Demo Code


//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;
    }
}

Related Tutorials