question: private double decodeTemperature ( byte [ ] data ) throws Exception { double temperatureValue ; byte flag = data [ 0 ] ; byte exponential = data [ 4 ] ; short firstOctet = convertNegativeByteToPositiveShort ( data [ 1 ] ) ; short secondOctet = convertNegativeByteToPositiveShort ( data [ 2 ] ) ; short thirdOctet = convertNegativeByteToPositiveShort ( data [ 3 ] ) ; int mantissa = ( ( thirdOctet << SHIFT_LEFT_16BITS ) | ( secondOctet << SHIFT_LEFT_8BITS ) | ( firstOctet ) ) & HIDE_MSB_8BITS_OUT_OF_32BITS ; mantissa = getTwosComplimentOfNegativeMantissa ( mantissa ) ; temperatureValue = ( mantissa * Math . pow ( 10 , exponential ) ) ; if ( ( flag & FIRST_BIT_MASK ) != 0 ) { temperatureValue = ( float ) ( ( temperatureValue - 32 ) * ( 5 / 9.0 ) ) ; } return temperatureValue ; }
target:  This method decode temperature value received from Health Thermometer device First byte {0} of data is flag and first bit of flag shows unit information of temperature. if bit 0 has value 1 then unit is Fahrenheit and Celsius otherwise Four bytes {1 to 4} after Flag bytes represent the temperature value in IEEE-11073 32-bit Float format