Java ByteBuffer Allocate allocateFloats(final int howmany, final int SIZE)

Here you can find the source of allocateFloats(final int howmany, final int SIZE)

Description

allocate Floats

License

Open Source License

Declaration

public static FloatBuffer allocateFloats(final int howmany, final 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 allocateFloats(final float[] floatarray, final int SIZE) {
        FloatBuffer fb = ByteBuffer.allocateDirect(floatarray.length * SIZE).order(ByteOrder.nativeOrder())
                .asFloatBuffer();//from www. j a va 2  s  . co  m
        fb.put(floatarray).flip();
        return fb;
    }

    public static FloatBuffer allocateFloats(final int howmany, final int SIZE) {
        return ByteBuffer.allocateDirect(howmany * SIZE).order(ByteOrder.nativeOrder()).asFloatBuffer();
    }
}

Related

  1. allocateBuffer(int size, boolean isDirect)
  2. allocateDirect(int capacity)
  3. allocateDirectBuffer(int size)
  4. allocateDirectInt(int size)
  5. allocateDoubles(final int howmany, final int SIZE)
  6. allocateInt()
  7. allocateInts(final int[] intarray, final int SIZE)
  8. allocateNativeOrderDirectBuffer(int size)
  9. allocateTestBuffer(int capacity, boolean direct)