pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/CRC16.java
@@ -34,7 +34,7 @@ * @return CRC */ @SuppressWarnings("unused") public int CRC(byte[] b, int startIndex, int endIndex) { public short CRC(byte[] b, int startIndex, int endIndex) { int crc = 0xFFFF; for (int j = startIndex ; j <= endIndex; j++) { crc = crc ^ ((b[j] + 256) % 256) ;//转换成无符号数,因为终端实现(C语言或汇编语言)都用的是无符号数 @@ -46,7 +46,7 @@ } } } return crc; return (short)crc; }