title: Polar Wearlink Bluetooth packet
body: <p>i am looking at the code of a project called MyTracks:</p>
  
  <p><a href="http://code.google.com/r/jrgert-polar-bluetooth/source/browse/MyTracks/src/com/google/android/apps/mytracks/services/sensors/PolarMessageParser.java?r=ebc01faf49550bc9801633ff38bb3b8ddd6f5698" rel="nofollow">http://code.google.com/r/jrgert-polar-bluetooth/source/browse/MyTracks/src/com/google/android/apps/mytracks/services/sensors/PolarMessageParser.java?r=ebc01faf49550bc9801633ff38bb3b8ddd6f5698</a></p>
  
  <p>Now I am having problems with the method <code>isValid(byte[] buffer)</code>. I don´t understand what exactly is he checking here. We want to know if the first byte in the array is the header containing 0xFE. I don´t quite understand the following lines :</p>
  
  <pre><code> boolean goodHdr = ((buffer[0] &amp; 0xFF) == 0xFE);
   boolean goodChk = ((buffer[2] &amp; 0xFF) == (0xFF - (buffer[1] &amp; 0xFF)));
   return goodHdr &amp;&amp; goodChk;    
  </code></pre>
  
  <p>any ideas?</p>