Java Utililty Methods Byte Array to Float

List of utility methods to do Byte Array to Float

Description

The list of methods to do Byte Array to Float are organized into topic(s).

Method

floatarr2float(byte[] b)
arrfloat
int i = 0;
int len = 4;
int cnt = 0;
byte[] tmp = new byte[len];
for (i = 0; i < len; i++) {
    tmp[cnt] = b[i];
    cnt++;
int accum = 0;
i = 0;
for (int shiftBy = 0; shiftBy < 32; shiftBy += 8) {
    accum |= ((long) (tmp[i] & 0xff)) << shiftBy;
    i++;
return Float.intBitsToFloat(accum);
floatbyteArrayToFloat(byte value[])
byte Array To Float
float temp = 0;
temp += (((int) value[0]) & 0xFF) << 24;
temp += (((int) value[1]) & 0xFF) << 16;
temp += (((int) value[2]) & 0xFF) << 8;
temp += (((int) value[3]) & 0xFF);
return temp;
floatbyteArrayToFloat(byte[] array)
byte Array To Float
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;
return Float.intBitsToFloat(accum);
...
floatbyteArrayToFloat(byte[] b)
byte Array To Float
int l = byteArrayToInt(b);
return Float.intBitsToFloat(l);
floatbyteArrayToFloat(byte[] byteArray)
byte Array To Float
return Float.intBitsToFloat(byteArrayToInt(byteArray));
floatbyteArrayToFloat(byte[] byteArray)
byte array to float
float number = 0f;
if (byteArray != null && byteArray.length == 4) {
    int intBits = 0;
    intBits = byteArray[0];
    intBits &= 0xff;
    intBits |= ((int) byteArray[1] << 8);
    intBits &= 0xffff;
    intBits |= ((int) byteArray[2] << 16);
...
FloatbyteArrayToFloat(byte[] bytes)
byte Array To Float
int bits = byteArrayToInt(bytes);
return Float.intBitsToFloat(bits);
floatbyteArrayToFloat(byte[] bytes, int size, int fpBits)
Convert a byte array to its floating point representation.
return byteArrayToLong(bytes, size) / (float) (1 << fpBits);
float[]byteArrayToFloatArray(byte[] bytes)
byte Array To Float Array
float[] floats = new float[bytes.length / 4];
for (int i = 0; i < floats.length; ++i)
    floats[i] = readFloatFromBytes(bytes, i * 4);
return floats;
floatbyteArrayToFloatBE(byte[] data)
byte Array To Float BE
if (data == null || data.length != 4)
    return 0x0;
return Float.intBitsToFloat(byteArrayToIntBE(data));