Android Byte Array to Float Convert ByteToFloat(byte[] b)

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

Description

Byte To Float

Declaration

public static float ByteToFloat(byte[] b) 

Method Source Code

//package com.java2s;

public class Main {
    public static float ByteToFloat(byte[] b) {
        return Float.intBitsToFloat(ByteToInt(b));
    }//from ww  w. j av a2s . com

    public static int ByteToInt(byte[] b) {
        int targets = (b[0] & 0xff) | ((b[1] << 8) & 0xff00)
                | ((b[2] << 24) >>> 8) | (b[3] << 24);

        return targets;

    }
}

Related

  1. bytesBE2float(byte[] b, int off)
  2. bytesBE2floats(byte[] b)
  3. bytesBE2floats2doubles(byte[] b)
  4. bytesLE2float(byte[] b, int off)