Java Byte Array to Float byteArrayToFloat(byte[] array)

Here you can find the source of byteArrayToFloat(byte[] array)

Description

byte Array To Float

License

LGPL

Declaration

public static float byteArrayToFloat(byte[] array) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    public static float byteArrayToFloat(byte[] array) {
        byte[] tmp = new byte[4];
        System.arraycopy(array, 0, tmp, 0, 4);
        int accum = 0;
        int i = 0;
        for (int shiftBy = 0; shiftBy < 32; shiftBy += 8) {
            accum |= ((long) (tmp[i++] & 0xff)) << shiftBy;
        }//from   w  ww. j a  v a2s .  com
        return Float.intBitsToFloat(accum);
    }
}

Related

  1. arr2float(byte[] b)
  2. byteArrayToFloat(byte value[])
  3. byteArrayToFloat(byte[] b)
  4. byteArrayToFloat(byte[] byteArray)
  5. byteArrayToFloat(byte[] byteArray)
  6. byteArrayToFloat(byte[] bytes)