Here you can find the source of list2FloatBuffer(List
public static FloatBuffer list2FloatBuffer(List<Float> list)
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; import java.util.List; public class Main { public static FloatBuffer list2FloatBuffer(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 ww w. j ava 2s . c o m*/ } fbb.position(0); return fbb; } }