银联(NUSAGE)字段算法优化

This commit is contained in:
zhanglei@ap-leasing.com.cn 2022-02-16 14:01:33 +08:00
parent 4b3f32d02c
commit 37bdfa617d

View File

@ -582,22 +582,16 @@ public class CmbToPayController extends BaseFlowStartAction {
for(int i = 0; i < c.length; i ++){
//二进制超过8位则为汉字
String len = Integer.toBinaryString(c[i]);
if(ChineseFlag){
if(len.length() > 8){
count=count+2;
if(len.length() > 8){
if(!ChineseFlag){
count=count+4;
ChineseFlag = true;
}else{
count ++;
ChineseFlag = false;
count=count+2;
}
}else{
if(len.length() > 8){
count=count+2+2;
ChineseFlag = true;
}else{
count ++;
ChineseFlag = false;
}
count ++;
ChineseFlag = false;
}
if(count==length){
str = str.substring(0,i+1);