Here you can find the source of toFloatArray(double[] doubleArray)
public static float[] toFloatArray(double[] doubleArray)
//package com.java2s; //License from project: LGPL public class Main { public static float[] toFloatArray(double[] doubleArray) { float[] floatArray = new float[doubleArray.length]; for (int i = 0; i < doubleArray.length; i++) { floatArray[i] = (float) doubleArray[i]; }/*from ww w . j ava 2 s . c o m*/ return floatArray; } public static float[] toFloatArray(double[][] doubleArray) { int w = doubleArray[0].length; int h = doubleArray.length; float[] floatArray = new float[w * h]; for (int j = 0; j < h; j++) { for (int i = 0; i < w; i++) { floatArray[j * w + i] = (float) doubleArray[j][i]; } } return floatArray; } }