Java Byte Array Big Endian BytesBEToFloat(final byte[] value)

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

Description

Bytes BE To Float

License

Creative Commons License

Declaration

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

Method Source Code

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

public class Main {
    public final static float BytesBEToFloat(final byte[] value) {
        return Float.intBitsToFloat(BytesBEToInt(value));
    }//from   ww w  .j a va2 s  .co  m

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

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

        return val;
    }
}

Related

  1. bytesBE2long(byte[] b, int off)
  2. BytesBEToInt(final byte[] buf)
  3. bytesHighFirstToChar(byte[] bytes, int start)
  4. bytesHighFirstToFloat(byte[] bytes, int start)
  5. bytesHighFirstToInt(byte[] bytes, int start)