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;i<17;i++)
{
iS += (int)(pszSrc[i]-'0') * iW[i];
}
int iY = iS%11;
return szVerCode[iY];
}
{
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;i<17;i++)
{
iS += (int)(pszSrc[i]-'0') * iW[i];
}
int iY = iS%11;
return szVerCode[iY];
}
标签:
JAVA,身份证,验证
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“JAVA 18位身份证号码校验码的算法”评论...