allocate Direct DoubleBuffer - Java java.nio

Java examples for java.nio:DoubleBuffer

Description

allocate Direct DoubleBuffer

Demo Code


//package com.java2s;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

import java.nio.DoubleBuffer;

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

    public static DoubleBuffer allocateDirectDouble(int size) {
        ByteBuffer bb = ByteBuffer.allocateDirect(size * 8);
        bb.order(ByteOrder.nativeOrder());
        return bb.asDoubleBuffer();
    }
}

Related Tutorials