Java Float Number Create toFloat(short[] arr)

Here you can find the source of toFloat(short[] arr)

Description

Converts an array of short values to an array of float values.

License

Open Source License

Parameter

Parameter Description
arr a short array

Return

a float array

Declaration

public static float[] toFloat(short[] arr) 

Method Source Code

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

public class Main {
    /**/*from   w ww .  ja v  a2s .  c o  m*/
     * Converts an array of short values to an array of float values. Returns a new
     * array.
     *
     * @param   arr a short array
     * @return  a float array
     */
    public static float[] toFloat(short[] arr) {
        int n = arr.length;
        float[] converted = new float[n];
        for (int i = 0; i < n; i++) {
            converted[i] = arr[i];
        }
        return converted;
    }

    /**
     * Converts an array of integer values to an array of float values. Returns a
     * new array.
     *
     * @param   arr an integer array
     * @return  a float array
     */
    public static float[] toFloat(int[] arr) {
        int n = arr.length;
        float[] converted = new float[n];
        for (int i = 0; i < n; i++) {
            converted[i] = arr[i];
        }
        return converted;
    }
}

Related

  1. toFloat(Object value)
  2. toFloat(Object value)
  3. toFloat(Object value)
  4. toFloat(Object value)
  5. toFloat(short half)
  6. toFloat(short[] src)
  7. toFloat(String parameter)
  8. toFloat(String property, float f)
  9. toFloat(String s)