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

floatgetFloat(byte[] buf, boolean bigEndian)
Convert byte sequence into float short from first 4 bytes
return Float.intBitsToFloat(getInt(buf, bigEndian));
floatgetFloat(byte[] bytes)
get Float
return Float.intBitsToFloat(getInt(bytes));
floatgetFloat(int offset, byte[] fromBytes)
get Float
final float toFloat;
final int fromInt = getInt(offset, fromBytes);
toFloat = Float.intBitsToFloat(fromInt);
return toFloat;
voidgetFloats(float[] toFloats, byte[] fromBytes)
get Floats
getFloats(toFloats, 0, fromBytes);
voidgetFloats(float[] toFloats, int offset, byte[] fromBytes)
get Floats
for (int floatInd = 0; floatInd < toFloats.length; ++floatInd) {
    final int fromInt = getInt(offset + floatInd * 4, fromBytes);
    float toFloat = Float.intBitsToFloat(fromInt);
    toFloats[floatInd] = toFloat;
floattoFloat(byte[] b, int pos)
to Float
int accum = 0;
for (int i = 0; i < 4; i++) {
    accum |= (b[i + pos] & 0xff) << i * 8;
return Float.intBitsToFloat(accum);
floattoFloatEx(byte[] b, int pos)
to Float Ex
try {
    byte[] byteTmp = new byte[4];
    for (int i = 0; i < 4; i++) {
        byteTmp[i] = b[pos + i];
    ByteBuffer bb = ByteBuffer.wrap(byteTmp);
    FloatBuffer fb = bb.asFloatBuffer();
    return fb.get();
...