Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.nio.FloatBuffer;

public class Main {
    /**
     * @param size number of floats the buffer should hold
     * @return the newly allocated float buffer
     */
    public static FloatBuffer createFloatBuffer(int size) {
        ByteBuffer bb = ByteBuffer.allocateDirect(4 * size);
        bb.order(ByteOrder.nativeOrder());
        return bb.asFloatBuffer();
    }
}