Android Utililty Methods Byte Array to Float Convert

List of utility methods to do Byte Array to Float Convert

Description

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

Method

floatByteToFloat(byte[] b)
Byte To Float
return Float.intBitsToFloat(ByteToInt(b));
floatbytesBE2float(byte[] b, int off)
bytes B Efloat
return Float.intBitsToFloat(bytesBE2int(b, off));
float[]bytesBE2floats(byte[] b)
bytes B Efloats
if (b == null)
    return null;
if ((b.length & 0x3) != 0)
    throw new IllegalArgumentException("byte[" + b.length + "]");
float[] val = new float[b.length >> 2];
for (int i = 0; i < val.length; i++)
    val[i] = bytesBE2float(b, i << 2);
return val;
...
double[]bytesBE2floats2doubles(byte[] b)
bytes B Efloatsdoubles
if (b == null)
    return null;
if ((b.length & 0x3) != 0)
    throw new IllegalArgumentException("byte[" + b.length + "]");
double[] val = new double[b.length >> 2];
for (int i = 0; i < val.length; i++)
    val[i] = bytesBE2float(b, i << 2);
return val;
...
floatbytesLE2float(byte[] b, int off)
bytes L Efloat
return Float.intBitsToFloat(bytesLE2int(b, off));
float[]bytesLE2floats(byte[] b)
bytes L Efloats
if (b == null)
    return null;
if ((b.length & 0x3) != 0)
    throw new IllegalArgumentException("byte[" + b.length + "]");
float[] val = new float[b.length >> 2];
for (int i = 0; i < val.length; i++)
    val[i] = bytesLE2float(b, i << 2);
return val;
...
double[]bytesLE2floats2doubles(byte[] b)
bytes L Efloatsdoubles
if (b == null)
    return null;
if ((b.length & 0x3) != 0)
    throw new IllegalArgumentException("byte[" + b.length + "]");
double[] val = new double[b.length >> 2];
for (int i = 0; i < val.length; i++)
    val[i] = bytesLE2float(b, i << 2);
return val;
...
floatbytesToFloat(byte[] bytes)
bytes To Float
if (bytes == null) {
    return 0f;
int value1 = byte2Integer(subByte(bytes, 0, 2));
int value2 = byte2Integer(subByte(bytes, 2));
int rv = Math.round((float) value2 / 100);
float rvf = rv / 10.0f;
if (value1 < 0) {
...
floatbytesToFloat(byte[] bytes, int start)
bytes To Float
FLOAT_BUFFER.position(0);
FLOAT_BUFFER.put(bytes, start, FLOAT_BYTES);
FLOAT_BUFFER.flip();
return FLOAT_BUFFER.getFloat(0);
floatgetFloat(byte[] b, int index)
get Float
int l;
l = b[index + 0];
l &= 0xff;
l |= ((long) b[index + 1] << 8);
l &= 0xffff;
l |= ((long) b[index + 2] << 16);
l &= 0xffffff;
l |= ((long) b[index + 3] << 24);
...