Java Array From toArray(Double[] array)

Here you can find the source of toArray(Double[] array)

Description

to Array

License

BSD License

Declaration

public static double[] toArray(Double[] array) 

Method Source Code

//package com.java2s;
/*L//from w w  w  .  j  a v a  2  s  .  c o  m
 * Copyright Oracle Inc, SAIC-F.
 *
 * Distributed under the OSI-approved BSD 3-Clause License.
 * See http://ncip.github.com/cadsr-bulk-loader/LICENSE.txt for details.
 */

public class Main {
    public static double[] toArray(Double[] array) {
        if (array == null) {
            return null;
        }

        double[] data = new double[array.length];
        for (int i = 0; i < array.length; i++) {
            double val = (array[i] == null) ? 0 : array[i].intValue();
            data[i] = val;
        }

        return data;
    }

    public static int[] toArray(Integer[] array) {
        if (array == null) {
            return null;
        }

        int[] data = new int[array.length];
        for (int i = 0; i < array.length; i++) {
            int val = (array[i] == null) ? 0 : array[i].intValue();
            data[i] = val;
        }

        return data;
    }
}

Related

  1. arrayFromString(String s)
  2. arrayFromString(String str)
  3. toArray(boolean[] array)
  4. toArray(CharSequence input)
  5. toArray(Class interfaceClass)
  6. toArray(E[] o)
  7. toArray(final double d)
  8. toArray(final int ip)
  9. ToArray(final Object... toSmashIntoArray)