Java FloatBuffer to Array getFloatArray(FloatBuffer buff)

Here you can find the source of getFloatArray(FloatBuffer buff)

Description

Create a new float[] array and populate it with the given FloatBuffer's contents.

License

Open Source License

Parameter

Parameter Description
buff the FloatBuffer to read from

Return

a new float array populated from the FloatBuffer

Declaration

public static float[] getFloatArray(FloatBuffer buff) 

Method Source Code

//package com.java2s;

import java.nio.FloatBuffer;

public class Main {
    /**/*from www .  ja  v  a  2 s  .  co  m*/
     * Create a new float[] array and populate it with the given FloatBuffer's
     * contents.
     *
     * @param buff the FloatBuffer to read from
     * @return a new float array populated from the FloatBuffer
     */
    public static float[] getFloatArray(FloatBuffer buff) {
        if (buff == null) {
            return null;
        }
        buff.clear();
        float[] inds = new float[buff.limit()];
        for (int x = 0; x < inds.length; x++) {
            inds[x] = buff.get();
        }
        return inds;
    }
}

Related

  1. convertFloatBufferToArray(java.nio.FloatBuffer buf)
  2. floatArrayToFloatBuffer(float[] data)
  3. floatBufferToHistogram(FloatBuffer ib, int width, int height, int widthStep, float[] histogram)
  4. floatBufferToString(FloatBuffer buffer)
  5. getFloatArray(final FloatBuffer buff)