Java Byte Array Little Endian BytesLEToFloat(final byte[] value)

Here you can find the source of BytesLEToFloat(final byte[] value)

Description

Bytes LE To Float

License

Creative Commons License

Declaration

public final static float BytesLEToFloat(final byte[] value) 

Method Source Code

//package com.java2s;
//License from project: Creative Commons License 

public class Main {
    public final static float BytesLEToFloat(final byte[] value) {
        return Float.intBitsToFloat(BytesLEToInt(value));
    }//  w  w w .jav  a2s  .  com

    public final static int BytesLEToInt(final byte[] buf) {
        int val = 0x0;

        for (int i = 0; i < buf.length; i++) {
            val += ((int) buf[i] & 0xFF) << (8 * i);
        }

        return val;
    }
}

Related

  1. bytesLE2ushorts(byte[] b)
  2. BytesLEToShort(final byte[] buf)
  3. bytesLittleToFloat(byte[] data, int start)
  4. bytesLittleToLong(byte[] data, int start)
  5. bytesLittleToShort(byte[] data, int start)