List of usage examples for java.lang Float intBitsToFloat
@HotSpotIntrinsicCandidate public static native float intBitsToFloat(int bits);
From source file:Main.java
public static float byte2float(byte[] b) { int value;/*from w w w. j a v a2 s. co m*/ value = b[0]; value &= 0xff; value |= ((long) b[1] << 8); value &= 0xffff; value |= ((long) b[2] << 16); value &= 0xffffff; value |= ((long) b[3] << 24); return Float.intBitsToFloat(value); }
From source file:Main.java
public static float byte2float(byte[] b, int index) { int l;//w w w . ja v a2 s .c o m 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); return Float.intBitsToFloat(l); }
From source file:Main.java
public static float byte4ToFloat_big(byte[] b, int index) { int l;//from w w w . j a v a 2s . c o m 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); return Float.intBitsToFloat(l); }
From source file:Main.java
public static float getFloat(byte[] b, int index) { int l = b[(index + 0)]; l &= 255;//from w ww .j a v a 2 s.co m l = (int) (l | b[(index + 1)] << 8); l &= 65535; l = (int) (l | b[(index + 2)] << 16); l &= 16777215; l = (int) (l | b[(index + 3)] << 24); return Float.intBitsToFloat(l); }
From source file:Main.java
public static float bytes2float(byte[] bytes, int index) { if (null == bytes || bytes.length < (4 + index)) { throw new RuntimeException("bytes of float error"); }/*from w ww . j a v a 2 s .c o m*/ int temp = bytes[index]; temp &= 0xff; temp |= ((long) bytes[index + 1] << 8); temp &= 0xffff; temp |= ((long) bytes[index + 2] << 16); temp &= 0xffffff; temp |= ((long) bytes[index + 3] << 24); return Float.intBitsToFloat(temp); }
From source file:Main.java
public static float toFloat(byte[] data) { if (data == null || data.length != 4) return 0x0; // ---------- simple: return Float.intBitsToFloat(toInt(data)); }
From source file:Main.java
public static float getFloat(byte[] b) { int accum = 0; accum = accum | (b[3] & 0xff) << 0; accum = accum | (b[2] & 0xff) << 8; accum = accum | (b[1] & 0xff) << 16; accum = accum | (b[0] & 0xff) << 24; return Float.intBitsToFloat(accum); }
From source file:Main.java
public static float toFloat(byte[] bytes, int offset) { return Float.intBitsToFloat(toInt(bytes, offset)); }
From source file:Main.java
public static float intBitsToFloat(int value) { return Float.intBitsToFloat(value); }
From source file:Main.java
private static float readFloat(byte[] bytes) { int bits = 0; bits = (int) (((bytes[0] << 24) & 0xff000000) | ((bytes[1] << 16) & 0x00ff0000) | ((bytes[2] << 8) & 0x0000ff00) | ((bytes[3] << 0) & 0x000000ff)); return Float.intBitsToFloat(bits); }