Android FloatBuffer Create wrap(float[] buffer)

Here you can find the source of wrap(float[] buffer)

Description

wrap

Declaration

public static FloatBuffer wrap(float[] buffer) 

Method Source Code

//package com.java2s;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.nio.ShortBuffer;

public class Main {

    public static FloatBuffer wrap(float[] buffer) {
        return (FloatBuffer) ByteBuffer.allocateDirect(buffer.length * 4)
                .order(ByteOrder.nativeOrder()).asFloatBuffer().put(buffer)
                .position(0);/*from   www. j a  va 2s.c om*/
    }

    public static ShortBuffer wrap(short[] buffer) {
        return (ShortBuffer) ByteBuffer.allocateDirect(buffer.length * 2)
                .order(ByteOrder.nativeOrder()).asShortBuffer().put(buffer)
                .position(0);
    }
}

Related

  1. list2FloatBuffer(List arr)
  2. list2FloatBuffer(List list)
  3. getFloatBuffer(float[] list)
  4. buildFloatBuffer(float[] buffer)
  5. asFloatBuffer(float[] array)
  6. makeFloatBuffer(float[] array)
  7. makeFloatBuffer(float[][] array, int rows, int cols)
  8. makeFloatBuffer(int length)
  9. ConvToFloatBuffer(float buf[])