@Test public void testCalculateCrcCccitt2() { int checkSum = CrcCccitt.calculateCrcCccitt(null); assertEquals(0, checkSum); checkSum = CrcCccitt.calculateCrcCccitt(null, 1, 10); assertEquals(0, checkSum); checkSum = CrcCccitt.calculateCrcCccitt("".getBytes(), 1, 10); assertEquals(0, checkSum); checkSum = CrcCccitt.calculateCrcCccitt("123".getBytes(), -1, 1); assertEquals(0, checkSum); checkSum = CrcCccitt.calculateCrcCccitt("1".getBytes(), 0, 10); assertEquals(0x2672, checkSum); checkSum = CrcCccitt.calculateCrcCccitt("123".getBytes(), 0, 1); assertEquals(0x2672, checkSum); checkSum = CrcCccitt.calculateCrcCccitt("0123456789abcdef".getBytes(), 1, 9); assertEquals(0x31c3, checkSum); checkSum = CrcCccitt.calculateCrcCccitt("0123456789abcdef".getBytes(), 5, 4); assertEquals(0xccf0, checkSum); }
public static int calculateCrcCccitt(byte[] msg) { return msg != null ? calculateCrcCccitt(msg, 0, msg.length) : 0; }
CrcCccitt { public static int calculateCrcCccitt(byte[] msg) { return msg != null ? calculateCrcCccitt(msg, 0, msg.length) : 0; } }
CrcCccitt { public static int calculateCrcCccitt(byte[] msg) { return msg != null ? calculateCrcCccitt(msg, 0, msg.length) : 0; }  }
CrcCccitt { public static int calculateCrcCccitt(byte[] msg) { return msg != null ? calculateCrcCccitt(msg, 0, msg.length) : 0; }  static boolean isValidMsgCRC(byte[] msgIncludingMsgCRC); static boolean isValidMsgCRC(byte[] msgIncludingMsgCRC, int offset, int count); static void setMsgCRC(byte[] msg); static int calculateCrcCccitt(byte[] msg); static int calculateCrcCccitt(byte[] msg, int offset, int count); }
CrcCccitt { public static int calculateCrcCccitt(byte[] msg) { return msg != null ? calculateCrcCccitt(msg, 0, msg.length) : 0; }  static boolean isValidMsgCRC(byte[] msgIncludingMsgCRC); static boolean isValidMsgCRC(byte[] msgIncludingMsgCRC, int offset, int count); static void setMsgCRC(byte[] msg); static int calculateCrcCccitt(byte[] msg); static int calculateCrcCccitt(byte[] msg, int offset, int count);  }