Android ByteBuffer Create list2ByteBuffer(List list)

Here you can find the source of list2ByteBuffer(List list)

Description

list Byte Buffer

Declaration

public static ByteBuffer list2ByteBuffer(List<Float> list)

Method Source Code

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

public class Main {
    public static ByteBuffer list2ByteBuffer(List<Float> list) {
        ByteBuffer ibb = ByteBuffer.allocateDirect(list.size() << 2);
        ibb.order(ByteOrder.nativeOrder());
        FloatBuffer fbb = ibb.asFloatBuffer();
        for (float f : list) {
            fbb.put(f);/*from  w  ww.  j a  va  2  s  .c  om*/
        }
        ibb.position(0);
        return ibb;
    }
}

Related

  1. arr2ByteBuffer(byte [] arr)
  2. arr2ByteBuffer(byte[] arr)
  3. arr2ByteBuffer(float [] arr)
  4. arr2ByteBuffer(float[] arr)
  5. list2ByteBuffer(List arr)
  6. makeByteBuffer(byte[] arr)
  7. makeByteBuffer(int size)
  8. newByteBuffer(int numBytes)
  9. newByteBuffer(int paramInt)