Here you can find the source of toDouble(int[] array)
Parameter | Description |
---|---|
array | Integer array. |
public static double[] toDouble(int[] array)
//package com.java2s; // under the BSD license. The original license terms are given below: public class Main { /**/*from w ww.ja v a2s . co m*/ * 1-D Integer array to double array. * @param array Integer array. * @return Double array. */ public static double[] toDouble(int[] array) { double[] n = new double[array.length]; for (int i = 0; i < array.length; i++) { n[i] = (double) array[i]; } return n; } /** * 2-D Integer array to double array. * @param array Integer array. * @return Double array. */ public static double[][] toDouble(int[][] array) { double[][] n = new double[array.length][array[0].length]; for (int i = 0; i < array.length; i++) { for (int j = 0; j < array[0].length; j++) { n[i][j] = (double) array[i][j]; } } return n; } /** * 1-D Float array to double array. * @param array Float array. * @return Double array. */ public static double[] toDouble(float[] array) { double[] n = new double[array.length]; for (int i = 0; i < array.length; i++) { n[i] = (double) array[i]; } return n; } /** * 2-D Float array to double array. * @param array Float array. * @return Double array. */ public static double[][] toDouble(float[][] array) { double[][] n = new double[array.length][array[0].length]; for (int i = 0; i < array.length; i++) { for (int j = 0; j < array[0].length; j++) { n[i][j] = (double) array[i][j]; } } return n; } }