求大神帮忙把这段求CRC校验码的C程序改成java程序!!在线等! 没啥可谢的,看你也挺急的,真正懂java又懂C的很少,就看大神们能不能看到了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public short CRC(byte[] arr, int len) { int index = 0; // Update the CRC for transmitted and received data using // the CCITT 16bit algorithm (X^16 + X^12 + X^5 + 1). short crc = 0; while (index < len) { crc = (short) ((crc >> 8) | (crc << 8)); crc ^= arr[index++]; crc ^= (char) (crc & 0xff) >> 4; crc ^= (crc << 8) << 4; crc ^= ((crc & 0xff) << 4) << 1; index++; } return crc; } 刚才有点问题,改成下面的:34567891011121314151617 public short CRC(byte[] arr, int len) { int index = 0; // Update the CRC for transmitted and received data using // the CCITT 16bit algorithm (X^16 + X^12 + X^5 + 1). short crc = 0; while (index < len) { crc = (short) ((crc >> 8) | (crc << 8)); crc ^= arr[index++]; crc ^= (char) (crc & 0xff) >> 4; crc ^= (crc << 8) << 4; crc ^= ((crc & 0xff) << 4) << 1; } return crc; } jar包默认加载顺序怎么更改? 一道关于百度搜索的笔试题,急求答案,多谢! struts2的action不能跳转到JSP页面 LODOP打印控件 java.lang.OutOfMemoryError: Java heap space SSH+Ajax程序无故终止?! 框架, 绞杀java?开源,泯灭java? 过渡时代的来临?面对java得迷惑! 我是做java的有必要学习一下.net吗? 在Struts中应该怎样将表单中输入的数据插入到数据库中? Linux下J2ee跑不起来,j2ee.jar好像解不开 求助!!! 如何在tomcat里配置使得本地访问地址类似于百度一样
public short CRC(byte[] arr, int len) { int index = 0;
// Update the CRC for transmitted and received data using
// the CCITT 16bit algorithm (X^16 + X^12 + X^5 + 1).
short crc = 0;
while (index < len) {
crc = (short) ((crc >> 8) | (crc << 8));
crc ^= arr[index++];
crc ^= (char) (crc & 0xff) >> 4;
crc ^= (crc << 8) << 4;
crc ^= ((crc & 0xff) << 4) << 1;
index++;
}
return crc;
}
4
5
6
7
8
9
10
11
12
13
14
15
16
17
public short CRC(byte[] arr, int len) {
int index = 0;
// Update the CRC for transmitted and received data using
// the CCITT 16bit algorithm (X^16 + X^12 + X^5 + 1).
short crc = 0;
while (index < len) {
crc = (short) ((crc >> 8) | (crc << 8));
crc ^= arr[index++];
crc ^= (char) (crc & 0xff) >> 4;
crc ^= (crc << 8) << 4;
crc ^= ((crc & 0xff) << 4) << 1;
}
return crc;
}