### Question:
CRC16 { public static byte[] calculate(byte[] buff, int start, int end) { int crcShort = 0; for (int i = start; i < end; i++) { crcShort = ((crcShort >>> 8) | (crcShort << 8) )& 0xffff; crcShort ^= (buff[i] & 0xff); crcShort ^= ((crcShort & 0xff) >> 4); crcShort ^= (crcShort << 12) & 0xffff; crcShort ^= ((crcShort & 0xFF) << 5) & 0xffff; } crcShort &= 0xffff; return new byte[] {(byte) (crcShort & 0xff), (byte) ((crcShort >> 8) & 0xff)}; }  static byte[] calculate(byte[] buff, int start, int end);  }### Answer:
@Test public void testCRC16() { byte[] testArray = new byte[]{(byte) 0x01, (byte) 0x07, (byte) 0x00, (byte) 0x10, (byte) 0x04}; byte[] expectedCrc = new byte[]{(byte) 0x8b, (byte) 0xb8}; byte[] calculatedCrc = CRC16.calculate(testArray, 0, testArray.length); assertThat(calculatedCrc, is(expectedCrc)); }