Android Byte Array to Float Convert getFloat(byte[] bytes)

Here you can find the source of getFloat(byte[] bytes)

Description

get Float

License

Open Source License

Declaration

public static float getFloat(byte[] bytes) 

Method Source Code

//package com.java2s;

public class Main {
    public static float getFloat(byte[] bytes) {
        return Float.intBitsToFloat(getInt(bytes));
    }//from ww w.j a  v  a  2s  .  c o  m

    public static int getInt(byte[] bytes) {
        return (0xff & bytes[0]) | (0xff00 & (bytes[1] << 8))
                | (0xff0000 & (bytes[2] << 16))
                | (0xff000000 & (bytes[3] << 24));
    }

    public static int getInt(byte b) {
        return (0xff & b);
    }
}

Related

  1. bytesLE2floats2doubles(byte[] b)
  2. bytesToFloat(byte[] bytes)
  3. bytesToFloat(byte[] bytes, int start)
  4. getFloat(byte[] b, int index)
  5. getFloat(byte[] buf, boolean bigEndian)
  6. getFloat(int offset, byte[] fromBytes)
  7. getFloats(float[] toFloats, byte[] fromBytes)
  8. getFloats(float[] toFloats, int offset, byte[] fromBytes)
  9. toFloat(byte[] b, int pos)