allocate Direct LongBuffer - Java java.nio

Java examples for java.nio:LongBuffer

Description

allocate Direct LongBuffer

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 size = 2;
        System.out.println(allocateDirectLong(size));
    }//w  w w  .ja  va  2 s  . c o  m

    public static LongBuffer allocateDirectLong(int size) {
        ByteBuffer bb = ByteBuffer.allocateDirect(size * 8);
        bb.order(ByteOrder.nativeOrder());
        return bb.asLongBuffer();
    }
}

Related Tutorials