@Tyhj
2017-08-18T00:48:49.000000Z
字数 388
阅读 1617
Java
最近用到LRC校验,我也是醉了,网上没有java代码,但是这个网站有讲算法和在线校验,就看了一下,其实很简单:
public static String lrcHexStr(String[] strings){
long all=Long.parseLong("0",16);
for (int i=0;i<strings.length;i++){
long one=Long.parseLong(strings[i],16);
all=all+one;
}
return Long.toHexString(256-(all%256));
}
//具体用法
public static void main(String args[]){
System.out.println(StrToAddHexStr(new String[]{"7a","40","b3","ff","01","7f"}));
}