title: Getting the CRC checksum of a byte array and adding it to that byte array
body: <p>I have this byte array:</p>
  
  <pre><code>static byte[] buf = new byte[] { (byte) 0x01, (byte) 0x04, (byte)0x00, (byte)0x01,(byte)0x00, (byte) 0x01};
  </code></pre>
  
  <p>Now, the CRC checksum of this byte array is supposed to be 0x60, 0x0A. I want the Java code to recreate this checksum, however I cant seem to recreate it. I have tried crc16:</p>
  
  <pre><code>static int crc16(final byte[] buffer) {
      int crc = 0xFFFF;
  
      for (int j = 0; j &lt; buffer.length ; j++) {
          crc = ((crc  &gt;&gt;&gt; 8) | (crc  &lt;&lt; 8) )&amp; 0xffff;
          crc ^= (buffer[j] &amp; 0xff);//byte to int, trunc sign
          crc ^= ((crc &amp; 0xff) &gt;&gt; 4);
          crc ^= (crc &lt;&lt; 12) &amp; 0xffff;
          crc ^= ((crc &amp; 0xFF) &lt;&lt; 5) &amp; 0xffff;
      }
      crc &amp;= 0xffff;
      return crc;
  
  }
  </code></pre>
  
  <p>and convert them using Integer.toHexString(), but none of the results match the correct CRC. Could someone please point me in the right direction in terms of CRC formula. </p>