Here you can find the source of toFloatArray(Collection
public static float[] toFloatArray(Collection<Float> array)
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { public static float[] toFloatArray(Collection<Float> array) { float[] resultArray = new float[array.size()]; int i = 0; for (float s : array) { resultArray[i++] = s;/*from www.ja va2 s. c o m*/ } return resultArray; } public static float[][] toFloatArray(Collection<Float>[] array) { float[][] resultArray = new float[array.length][]; int i = 0; for (int j = 0; j < array.length; j++) { resultArray[j] = new float[array[j].size()]; for (float s : array[j]) { resultArray[j][i++] = s; } } return resultArray; } }