Java Float Array Create toFloatArray(final Object[] array)

Here you can find the source of toFloatArray(final Object[] array)

Description

to Float Array

License

Open Source License

Declaration

public static float[] toFloatArray(final Object[] array) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static float[] toFloatArray(final Object[] array) {
        if (array == null) {
            return new float[0];
        }/*from w ww. ja  v  a 2 s  . c  o  m*/

        final float[] retVal = new float[array.length];

        try {
            for (int i = 0; i < array.length; i++) {
                retVal[i] = Float.parseFloat(String.valueOf(array[i]));
            }

            return retVal;
        } catch (Exception e) {
            return new float[0];
        }
    }
}

Related

  1. toFloatArray(byte[] data)
  2. toFloatArray(double[] doubleArray)
  3. toFloatArray(double[][] array)
  4. toFloatArray(final byte[] array)
  5. toFloatArray(final double[] doubleArray)
  6. toFloatArray(Float[] data)
  7. toFloatArray(Number[] array)
  8. toFloatArray(Object[] arr)
  9. toFloatArray(String str, String separator)