Java Double Convert to convertDoublesToFloats(double[] input)

Here you can find the source of convertDoublesToFloats(double[] input)

Description

converts a double array into a float array; USE WITH CAUTION as precision might be lost!

License

Open Source License

Parameter

Parameter Description
input a parameter

Return

array with doubles

Declaration

public static float[] convertDoublesToFloats(double[] input) 

Method Source Code

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

public class Main {
    /**/*from   w w w  .j a v  a  2 s.com*/
     * converts a double array into a float array; USE WITH CAUTION as precision might be lost! 
     * @param input
     * @return array with doubles
     */
    public static float[] convertDoublesToFloats(double[] input) {
        if (input == null) {
            return null;
        }
        float[] output = new float[input.length];
        for (int i = 0; i < input.length; i++) {
            output[i] = (float) input[i];
        }
        return output;
    }
}

Related

  1. convertDoubleMatrixToFloat(double[][] input, int dimRows, int dimColoumns)
  2. convertDoubleNumberFromSciNotation(String numberInScientificNotation)
  3. convertDoubles(Double[] doubles)
  4. convertDoubleShareToString(double shares)
  5. convertDoubleSizeToViPRLong(double size)
  6. convertdoubleToDouble(double[][] dbleArray)
  7. convertDoubleToFloat(final double[][] doubleSeries)
  8. convertDoubleToLong(Double value)
  9. convertDoubleToPercentage(double doub)