JAVA 18位身份证号码校验码的算法
public static char doVerify(String id)
{
char pszSrc[]=id.toCharArray();
int iS = 0;
int iW[]={7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};
char szVerCode[] = new char[]{'1','0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'};
int i;
for(i=0;i17;i++)
{
iS += (int)(pszSrc[i]-'0') * iW[i];
}
int iY = iS%11;
return szVerCode[iY];
}
您可能感兴趣的文章:- java身份证合法性校验工具类实例代码
- java身份证合法性校验并提取身份证有效信息
- Java身份证号码校验工具类详解
相关文章
- JAVA 18位身份证号码校验码的算法
- public static char doVerify(String id) { char pszSrc[]=id.toCharArray(); int iS = 0; int iW[]={7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2}; char szVerCode[] = new char[]{\'1\',\'0\', \'X\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\'}; int i;JAVA,18位,身份证,号码,校验,...
- JAVA 18位身份证号码校验码的算法
- public static char doVerify(String id) { char pszSrc[]=id.toCharArray(); int iS = 0; int iW[]={7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2}; char szVerCode[] = new char[]{\'1\',\'0\', \'X\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\'}; int i;JAVA,18位,身份证,号码,校验,...