Java Double Array Create toDoubleArray(String[] arr)

Here you can find the source of toDoubleArray(String[] arr)

Description

to Double Array

License

Open Source License

Declaration

public static Double[] toDoubleArray(String[] arr) 

Method Source Code

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

public class Main {
    public static Double[] toDoubleArray(String[] arr) {
        int n = arr.length;
        Double[] da = new Double[n];
        int i = 0;
        for (String e : arr) {
            da[i++] = Double.parseDouble(e);
        }/*from ww w. j a  v  a 2  s . co  m*/
        return da;
    }

    public static Double[] toDoubleArray(String[] arr, int startFrom) {
        int n = arr.length;
        Double[] da = new Double[n - startFrom];
        int i = 0;
        for (int k = startFrom; k < n; k++) {
            da[i++] = Double.parseDouble(arr[k]);
        }
        return da;
    }

    public static Double[] toDoubleArray(String[] arr, int startFrom, int to) {
        int n = arr.length;
        Double[] da = new Double[to - startFrom + 1];
        int i = 0;
        for (int k = startFrom; k <= to; k++) {
            da[i++] = Double.parseDouble(arr[k]);
        }
        return da;
    }
}

Related

  1. toDoubleArray(Number[] array)
  2. toDoubleArray(String array)
  3. toDoubleArray(String str, String separator)
  4. toDoubleArray(String value)
  5. toDoubleArray(String[] anArray)
  6. toDoubleArray(String[] in)
  7. toDoubleArray(String[] inArray)