title: How can I calculate Longitudinal Redundancy Check (LRC)?
body: <p>I've tried the example from wikipedia: <a href="http://en.wikipedia.org/wiki/Longitudinal_redundancy_check" rel="noreferrer">http://en.wikipedia.org/wiki/Longitudinal_redundancy_check</a></p>
  
  <p>This is the code for lrc (C#):</p>
  
  <pre><code>/// &lt;summary&gt;
  /// Longitudinal Redundancy Check (LRC) calculator for a byte array. 
  /// ex) DATA (hex 6 bytes): 02 30 30 31 23 03
  ///     LRC  (hex 1 byte ): EC    
  /// &lt;/summary&gt; 
  public static byte calculateLRC(byte[] bytes)
  {
      byte LRC = 0x00;
      for (int i = 0; i &lt; bytes.Length; i++)
      {
          LRC = (LRC + bytes[i]) &amp; 0xFF; 
      }
      return ((LRC ^ 0xFF) + 1) &amp; 0xFF;
  }   
  </code></pre>
  
  <p>It said the result is "EC" but I get "71", what I'm doing wrong? </p>
  
  <p>Thanks.</p>