Here you can find the source of convertFloatDouble(float[] in)
Parameter | Description |
---|---|
in | the input array |
public static double[] convertFloatDouble(float[] in)
//package com.java2s; /** Implement various functionality for working with arrays and Lists * * @package SciTK//from w w w . java 2 s . c o m * @class ArrayUtil * @brief Convert arrays * @author Alex Zylstra * @date 2013/04/15 * @copyright Alex Zylstra * @license SciTK / MIT License */ public class Main { /** * Convert a 1-D float array to double [] * @param in the input array * @return input array cast as doubles */ public static double[] convertFloatDouble(float[] in) { // need to explicitly convert each item: double[] out = new double[in.length]; for (int i = 0; i < out.length; i++) { out[i] = (double) in[i]; } return out; } /** * Convert a 2-D float array to double [][] * @param in the input array * @return input array cast as doubles */ public static double[][] convertFloatDouble(float[][] in) { // need to explicitly convert each item: double[][] out = new double[in.length][in[0].length]; for (int i = 0; i < out.length; i++) { for (int j = 0; j < out[i].length; j++) { out[i][j] = (double) in[i][j]; } } return out; } /** * Convert a 3-D float array to double [][] * @param in the input array * @return input array cast as doubles */ public static double[][][] convertFloatDouble(float[][][] in) { // need to explicitly convert each item: double[][][] out = new double[in.length][in[0].length][in[0][0].length]; for (int i = 0; i < out.length; i++) { for (int j = 0; j < out[i].length; j++) { for (int k = 0; k < out[i][j].length; k++) { out[i][j][k] = (double) in[i][j][k]; } } } return out; } }