public static int crc16(byte[] data) { int crc = 0xffff; int dxs = 0xa001; int hibyte; int sbit; for (int i = 0; i < data.length; i++) { hibyte = crc >> 8; crc = hibyte ^ data[i]; for (int j = 0; j < 8; j++) { sbit = crc & 0x0001; crc = crc >> 1; if (sbit == 1) crc ^= dxs; } } return (int) (crc & 0xffff); }
java crc校验 crc16位校验
最新推荐文章于 2024-10-06 17:53:54 发布