Java Byte Array to Float byteToFloat(byte[] b)

Here you can find the source of byteToFloat(byte[] b)

Description

byte To Float

License

Apache License

Declaration

public static float byteToFloat(byte[] b) 

Method Source Code

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

public class Main {

    public static float byteToFloat(byte[] b) {
        int l;/* w w  w.  j  a  va 2 s .  c  o m*/
        l = b[0];
        l &= 0xff;
        l |= ((long) b[1] << 8);
        l &= 0xffff;
        l |= ((long) b[2] << 16);
        l &= 0xffffff;
        l |= ((long) b[3] << 24);
        l &= 0xffffffffl;

        return Float.intBitsToFloat(l);
    }
}

Related

  1. bytesToFloat(byte[] b, int offset)
  2. bytesToFloat(byte[] bytes)
  3. bytesToFloat(byte[] bytes, int beg)
  4. bytesToFloat(byte[] bytes, int startIndex)
  5. byteToFloat(byte[] b)