Java Float Number Create toFloat(double[] a)

Here you can find the source of toFloat(double[] a)

Description

Convert the input array to a float

License

Open Source License

Parameter

Parameter Description
a a parameter

Return

The new array

Declaration

public static float[] toFloat(double[] a) 

Method Source Code

//package com.java2s;
/*----------------------------------------------------------------------------- 
 * GDSC SMLM Software//from  w w  w  .  j  a v  a 2  s  . com
 * 
 * Copyright (C) 2016 Alex Herbert
 * Genome Damage and Stability Centre
 * University of Sussex, UK
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *---------------------------------------------------------------------------*/

public class Main {
    /**
     * Convert the input array to a float
     * 
     * @param a
     * @return The new array
     */
    public static float[] toFloat(double[] a) {
        if (a == null)
            return null;
        float[] b = new float[a.length];
        for (int i = 0; i < a.length; i++)
            b[i] = (float) a[i];
        return b;
    }
}

Related

  1. toFloat(byte[] si, boolean isReverseOrder)
  2. toFloat(byte[] value)
  3. toFloat(byte[][] a)
  4. toFloat(double in1)
  5. toFloat(double[] a)
  6. toFloat(double[] in)
  7. toFloat(double[] v)
  8. toFloat(final byte[] ba)
  9. toFloat(final byte[] inputBytes, final int offset)