new Byte Buffer - Java java.nio

Java examples for java.nio:ByteBuffer

Description

new Byte Buffer

Demo Code


//package com.java2s;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class Main {
    public static void main(String[] argv) throws Exception {
        int paramInt = 2;
        System.out.println(newByteBuffer(paramInt));
    }//  ww w . ja v a  2  s  .c  om

    public static ByteBuffer newByteBuffer(int paramInt) {
        ByteBuffer localByteBuffer = ByteBuffer.allocateDirect(paramInt);
        localByteBuffer.order(ByteOrder.nativeOrder());
        return localByteBuffer;
    }
}

Related Tutorials