Java Float Number Create toFloat(byte[][] a)

Here you can find the source of toFloat(byte[][] a)

Description

to Float

License

Apache License

Declaration

public static final float[][] toFloat(byte[][] a) 

Method Source Code

//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;
    }
}

Related

  1. toFloat(byte[] data)
  2. toFloat(byte[] data)
  3. toFloat(byte[] data, int offset)
  4. toFloat(byte[] si, boolean isReverseOrder)
  5. toFloat(byte[] value)
  6. toFloat(double in1)
  7. toFloat(double[] a)
  8. toFloat(double[] a)
  9. toFloat(double[] in)