Java Array Cast arrayCastToDouble(int[] arrayInt)

Here you can find the source of arrayCastToDouble(int[] arrayInt)

Description

array Cast To Double

License

Open Source License

Declaration

public static double[] arrayCastToDouble(int[] arrayInt) 

Method Source Code

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

public class Main {
    public static double[] arrayCastToDouble(int[] arrayInt) {
        double[] arrayDouble = new double[arrayInt.length];

        for (int i = 0; i < arrayDouble.length; i++)
            arrayDouble[i] = (double) arrayInt[i];

        return arrayDouble;
    }//from   w ww . j av  a  2 s  . c  om

    public static double[] arrayCastToDouble(Integer[] arrayInt) {
        double[] arrayDouble = new double[arrayInt.length];

        for (int i = 0; i < arrayDouble.length; i++)
            arrayDouble[i] = arrayInt[i].doubleValue();

        return arrayDouble;
    }

    public static double[] arrayCastToDouble(Double[] arrayIn) {
        double[] arrayDouble = new double[arrayIn.length];

        for (int i = 0; i < arrayDouble.length; i++)
            arrayDouble[i] = arrayIn[i];

        return arrayDouble;
    }

    public static double[] arrayCastToDouble(float[] arrayFloat) {
        double[] arrayDouble = new double[arrayFloat.length];

        for (int i = 0; i < arrayDouble.length; i++)
            arrayDouble[i] = (double) arrayFloat[i];

        return arrayDouble;
    }

    public static double[] arrayCastToDouble(String[] arrayString) {
        double[] arrayDouble = new double[arrayString.length];

        for (int i = 0; i < arrayDouble.length; i++)
            arrayDouble[i] = Double.parseDouble(arrayString[i]);

        return arrayDouble;
    }
}

Related

  1. arrayCastToInt(double[] a)