Android Utililty Methods FloatBuffer Create

List of utility methods to do FloatBuffer Create

Description

The list of methods to do FloatBuffer Create are organized into topic(s).

Method

FloatBufferbuildFloatBuffer(float[] buffer)
build FloatBuffer: float[] -> FloatBuffer
FloatBuffer ret = null;
if (buffer != null) {
    ByteBuffer byteBuffer = ByteBuffer
            .allocateDirect(buffer.length * 4);
    byteBuffer.order(ByteOrder.nativeOrder());
    ret = byteBuffer.asFloatBuffer();
    ret.put(buffer);
    ret.position(0);
...
FloatBufferasFloatBuffer(float[] array)
as Float Buffer
ByteBuffer bbuf = ByteBuffer.allocateDirect(array.length
        * BYTES_PER_FLOAT);
bbuf.order(ByteOrder.nativeOrder());
FloatBuffer fbuf = bbuf.asFloatBuffer();
fbuf.put(array);
fbuf.position(0);
return fbuf;
FloatBufferwrap(float[] buffer)
wrap
return (FloatBuffer) ByteBuffer.allocateDirect(buffer.length * 4)
        .order(ByteOrder.nativeOrder()).asFloatBuffer().put(buffer)
        .position(0);
FloatBuffermakeFloatBuffer(float[] array)
make Float Buffer
final int floatSize = Float.SIZE / 8;
ByteBuffer byteBuffer = ByteBuffer.allocateDirect(array.length
        * floatSize);
byteBuffer.order(ByteOrder.nativeOrder());
FloatBuffer floatBuffer = byteBuffer.asFloatBuffer();
floatBuffer.put(array);
floatBuffer.position(0);
return floatBuffer;
...
FloatBuffermakeFloatBuffer(float[][] array, int rows, int cols)
make Float Buffer
float[] result = new float[rows * cols];
for (int i = 0, k = 0; i < rows; i++)
    for (int j = 0; j < cols; j++)
        result[k++] = array[i][j];
return makeFloatBuffer(result);
FloatBuffermakeFloatBuffer(int length)
make Float Buffer
final int floatSize = Float.SIZE / 8;
ByteBuffer byteBuffer = ByteBuffer.allocateDirect(length
        * floatSize);
byteBuffer.order(ByteOrder.nativeOrder());
FloatBuffer floatBuffer = byteBuffer.asFloatBuffer();
floatBuffer.position(0);
return floatBuffer;
FloatBufferConvToFloatBuffer(float buf[])
Conv To Float Buffer
FloatBuffer ReturnBuffer;
ByteBuffer vbb = ByteBuffer.allocateDirect(buf.length * 4);
vbb.order(ByteOrder.nativeOrder());
ReturnBuffer = vbb.asFloatBuffer();
ReturnBuffer.put(buf);
ReturnBuffer.position(0);
return ReturnBuffer;
FloatBufferConvToFloatBuffer(float buf[])
Conv To Float Buffer
FloatBuffer ReturnBuffer;
ByteBuffer vbb = ByteBuffer.allocateDirect(buf.length * 4);
vbb.order(ByteOrder.nativeOrder());
ReturnBuffer = vbb.asFloatBuffer();
ReturnBuffer.put(buf);
ReturnBuffer.position(0);
return ReturnBuffer;
FloatBuffermakeFloatBuffer(float[] arr)
Make a direct NIO FloatBuffer from an array of floats
ByteBuffer bb = ByteBuffer.allocateDirect(arr.length * 4);
bb.order(ByteOrder.nativeOrder());
FloatBuffer fb = bb.asFloatBuffer();
fb.put(arr);
fb.position(0);
return fb;
FloatBuffermakeFloatBuffer(float[] i_arr)
make Float Buffer
ByteBuffer bb = ByteBuffer.allocateDirect(i_arr.length * 4);
bb.order(ByteOrder.nativeOrder());
FloatBuffer fb = bb.asFloatBuffer();
fb.put(i_arr);
fb.position(0);
return fb;