new Long Buffer - Java java.nio

Java examples for java.nio:LongBuffer

Description

new Long Buffer

Demo Code


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

import java.nio.LongBuffer;

public class Main {
    public static void main(String[] argv) throws Exception {
        int paramInt = 2;
        System.out.println(newLongBuffer(paramInt));
    }/*from  w  w  w .j av a 2  s .  c  o m*/

    public static LongBuffer newLongBuffer(int paramInt) {
        ByteBuffer localByteBuffer = newByteBuffer(paramInt * 8);
        return localByteBuffer.asLongBuffer();
    }

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

Related Tutorials