Here you can find the source of bytesToFloat(byte[] bytes, int beg)
Parameter | Description |
---|---|
bytes | The bytes array |
beg | The beginning index of the float value |
private static float bytesToFloat(byte[] bytes, int beg)
//package com.java2s; //License from project: Open Source License public class Main { /**// w ww . ja va 2 s .co m * Convert a byte array to float. The byte array * is returned by ShopPositioningServer. * * @param bytes The bytes array * @param beg The beginning index of the float value * @return The float value */ private static float bytesToFloat(byte[] bytes, int beg) { int bits = 0; bits |= (bytes[beg + 3] & 0xff); bits |= (bytes[beg + 2] & 0xff) << 8; bits |= (bytes[beg + 1] & 0xff) << 16; bits |= (bytes[beg] & 0xff) << 24; return Float.intBitsToFloat(bits); } }