Java Double Array Create toDoubleArray(String value)

Here you can find the source of toDoubleArray(String value)

Description

to Double Array

License

Open Source License

Declaration

public static double[] toDoubleArray(String value) 

Method Source Code

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

public class Main {
    public static double[] toDoubleArray(String value) {
        String[] values = value.split("\\s");
        double[] array = new double[values.length];
        for (int i = 0; i < values.length; i++) {
            values[i] = values[i].trim();
            if (values[i].length() > 0) {
                array[i] = Double.valueOf(values[i]);
            }//from   w  w w  .  j a  v a2  s.  com
        }
        return array;
    }

    public static double[] toDoubleArray(Double[] array) {
        double[] result = new double[array.length];
        for (int i = 0; i < array.length; i++) {
            result[i] = array[i].doubleValue();
        }
        return result;
    }
}

Related

  1. toDoubleArray(int... intArray)
  2. toDoubleArray(int[] ints)
  3. toDoubleArray(Number[] array)
  4. toDoubleArray(String array)
  5. toDoubleArray(String str, String separator)
  6. toDoubleArray(String[] anArray)
  7. toDoubleArray(String[] arr)
  8. toDoubleArray(String[] in)
  9. toDoubleArray(String[] inArray)