CRC16算法系列文章:java
前言
CRC16算法有不少种,本篇文章会介绍其中的CRC16-CCITT-XMODEM算法算法
功能
实现CRC16-CCITT-XMODEM算法数组
支持int、short类型ui
支持选择数组区域计算spa
实现
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
public static int crc16_ccitt_xmodem(byte[] bytes) {
-
return crc16_ccitt_xmodem(bytes,0,bytes.length);
-
-
-
-
-
-
-
-
-
-
public static int crc16_ccitt_xmodem(byte[] bytes,int offset,int count) {
-
-
-
for (int index = offset; index < count; index++) {
-
-
for (int i = 0; i < 8; i++) {
-
boolean bit = ((b >> (7 - i) & 1) == 1);
-
boolean c15 = ((crc >> 15 & 1) == 1);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
public static short crc16_ccitt_xmodem_short(byte[] bytes,int offset,int count) {
-
return (short)crc16_ccitt_xmodem(bytes,offset,count);
-
-
-
-
-
-
-
-
-
public static short crc16_ccitt_xmodem_short(byte[] bytes) {
-
return crc16_ccitt_xmodem_short(bytes,0,bytes.length);
-
-
-
---end---.net