public static int getCrc_CRC16_X25(byte[] bytes) { int i, j, lsb; int h = 0xffff; for (i = 0; i < bytes.length; i++) { h ^= (bytes[i] & 0xff); h &= 0xffff; for (j = 0; j < 8; j++) { lsb = h & 0x0001; //取 CRC 的移出位 h >>= 1; if (lsb == 1) { h ^= 0x8408; h &= 0xffff; } } } h ^= 0xffff; return h; }