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;
}

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 ; }
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
