title: crc16 implementation java
body: <p>I am having problems with calculating CRC-16 implementation of a byte array in java. Basically I am trying to send bytes to a RFID that starts writing to a tag. I can see the checksum value of array by looking tcpdump command on mac. But my goal is to generate it by myself. Here is my byte array which should generate 0xbe,0xd9:</p>
  
  <pre><code>byte[] bytes = new byte[]{(byte) 0x55,(byte) 0x08,(byte) 0x68, (byte) 0x14, 
                            (byte) 0x93, (byte) 0x01, (byte) 0x00, (byte) 0x00, 
                            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x06, 
                            (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x00, 
                            (byte) 0x13, (byte) 0x50, (byte) 0x00, (byte) 0x00, 
                            (byte) 0x00, (byte) 0x22, (byte) 0x09, (byte) 0x11};
  </code></pre>
  
  <p>0x55 is the header. As the documentation says it will be excluded. </p>
  
  <p>Whenever I try this array on java (with 0xbe,0xd9), RFID works. My problem is the generating of those checksum values. I searched almost entire web but no chance. I couldn't find any algorithm that produces 0xbe,0xd9. </p>
  
  <p>Any idea is most welcome for me. Thanks in advance.</p>
  
  <p>edit: <a href="https://hotfile.com/dl/171580071/36ac860/Reader_Communication_protocol.doc.html" rel="noreferrer">here is the protocol</a> that provided with rfid</p>