Here you can find the source of toFloat(byte[][] a)
public static final float[][] toFloat(byte[][] a)
//package com.java2s; //License from project: Apache License public class Main { public static final float[][] toFloat(byte[][] a) { float[][] b = new float[a.length][a[0].length]; for (int i = 0; i < a.length; i++) for (int j = 0; j < a[0].length; j++) { b[i][j] = (float) a[i][j]; }//w w w .j av a 2 s . c om return b; } public static final float[][][] toFloat(byte[][][] a) { float[][][] b = new float[a.length][a[0].length][a[0][0].length]; for (int i = 0; i < a.length; i++) for (int j = 0; j < a[0].length; j++) for (int k = 0; k < a[0][0].length; k++) { b[i][j][k] = (float) a[i][j][k]; } return b; } public static final float[][] toFloat(double[][] a) { float[][] b = new float[a.length][a[0].length]; for (int i = 0; i < a.length; i++) for (int j = 0; j < a[0].length; j++) { b[i][j] = (float) a[i][j]; } return b; } public static final float[][] toFloat(int[][] a) { float[][] b = new float[a.length][a[0].length]; for (int i = 0; i < a.length; i++) for (int j = 0; j < a[0].length; j++) { b[i][j] = a[i][j]; } return b; } public static final float[] toFloat(double[] a) { float[] b = new float[a.length]; for (int i = 0; i < a.length; i++) { b[i] = (float) a[i]; } return b; } public static final float[] toFloat(int[] a) { float[] b = new float[a.length]; for (int i = 0; i < a.length; i++) { b[i] = a[i]; } return b; } public static final float[] toFloat(boolean[] a) { float[] b = new float[a.length]; for (int i = 0; i < a.length; i++) { if (a[i]) b[i] = 1f; } return b; } }