List of utility methods to do Byte Array to Float Convert
float | getFloat(byte[] buf, boolean bigEndian) Convert byte sequence into float short from first 4 bytes return Float.intBitsToFloat(getInt(buf, bigEndian));
|
float | getFloat(byte[] bytes) get Float return Float.intBitsToFloat(getInt(bytes));
|
float | getFloat(int offset, byte[] fromBytes) get Float final float toFloat; final int fromInt = getInt(offset, fromBytes); toFloat = Float.intBitsToFloat(fromInt); return toFloat; |
void | getFloats(float[] toFloats, byte[] fromBytes) get Floats getFloats(toFloats, 0, fromBytes); |
void | getFloats(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; |
float | toFloat(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); |
float | toFloatEx(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(); ... |