Crc16 { public static short calculate(short crcValue, byte data) { short x = (short) (((crcValue >>> 8) ^ data) & 0xff); x ^= (x >>> 4); return (short) ((crcValue << 8) ^ (x << 12) ^ (x << 5) ^ x); }  static short calculate(short crcValue, byte data); static short calculate(byte[] data, int offset, int length); static short calculate(byte[] data); static final short INIT_VALUE; }
@Test public void testCalculateByteArray() throws Exception { assertEquals(0x29b1, Crc16.calculate("123456789".getBytes("UTF-8"))); }