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 {
    public static FloatBuffer getBufferFromFloatArray(float[] array) {
        FloatBuffer result = ByteBuffer.allocateDirect(array.length * 4).order(ByteOrder.nativeOrder())
                .asFloatBuffer();
        result.put(array).position(0);
        return result;
    }
}