Android FloatBuffer Create makeFloatBuffer(int size)

Here you can find the source of makeFloatBuffer(int size)

Description

make Float Buffer

Declaration

public static FloatBuffer makeFloatBuffer(int size) 

Method Source Code

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

public class Main {
    public static FloatBuffer makeFloatBuffer(float[] arr) {
        ByteBuffer bb = ByteBuffer.allocateDirect(arr.length * 4);
        bb.order(ByteOrder.nativeOrder());
        FloatBuffer fb = bb.asFloatBuffer();
        fb.put(arr);/*  w  w  w.j av  a2s  . c o  m*/
        fb.position(0);
        return fb;
    }

    public static FloatBuffer makeFloatBuffer(int size) {
        ByteBuffer bb = ByteBuffer.allocateDirect(size * 4);
        bb.order(ByteOrder.nativeOrder());
        FloatBuffer fb = bb.asFloatBuffer();
        fb.position(0);
        return fb;
    }
}

Related

  1. createFloatBuffer(int size)
  2. createDirectFloatBuffer( final int capacity)
  3. createDirectFloatBuffer( final int capacity, final FloatBuffer previous)
  4. makeFloatBuffer(float[] arr)
  5. makeFloatBuffer(float[] arr)
  6. newFloatBuffer(int numFloats)
  7. newFloatBuffer(int numFloats)
  8. newFloatBuffer(int paramInt)
  9. toFloatBuffer(float[] array)