Android FloatBuffer Create getFloatBuffer(float[] list)

Here you can find the source of getFloatBuffer(float[] list)

Description

Genera un FloatBuffer a partir de un array de floats

Parameter

Parameter Description
lista de floats

Return

FloatBuffer resultante

Declaration

public static FloatBuffer getFloatBuffer(float[] list) 

Method Source Code

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

public class Main {
    /**//  w  w w.ja  v a  2s .c om
     * Genera un FloatBuffer a partir de un array de floats
     * @param lista de floats
     * @return FloatBuffer resultante
     */
    public static FloatBuffer getFloatBuffer(float[] list) {
        ByteBuffer bb = ByteBuffer.allocateDirect(list.length * Float.SIZE
                / 8);
        bb.order(ByteOrder.nativeOrder());
        FloatBuffer fb = bb.asFloatBuffer();

        fb.put(list);
        fb.position(0);
        return fb;
    }
}

Related

  1. floatToBuffer(float[] a)
  2. floatToBuffer(float[] a)
  3. setupFloatBuffer(FloatBuffer preBuffer, float[] array)
  4. list2FloatBuffer(List arr)
  5. list2FloatBuffer(List list)
  6. buildFloatBuffer(float[] buffer)
  7. asFloatBuffer(float[] array)
  8. wrap(float[] buffer)
  9. makeFloatBuffer(float[] array)