Java Double Array Create toDoubleArray(final Object[] array)

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

Description

to Double Array

License

Open Source License

Declaration

public static double[] toDoubleArray(final Object[] array) 

Method Source Code

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

public class Main {
    public static double[] toDoubleArray(final Object[] array) {
        if (array == null) {
            return new double[0];
        }/*ww  w.ja va 2 s  .c o  m*/

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

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

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

Related

  1. toDoubleArray(byte[] byteArray)
  2. toDoubleArray(byte[] data)
  3. toDoubleArray(Double[] data)
  4. toDoubleArray(final byte[] array)
  5. toDoubleArray(final long[] array)
  6. toDoubleArray(int... intArray)
  7. toDoubleArray(int[] ints)
  8. toDoubleArray(Number[] array)
  9. toDoubleArray(String array)