Calc National ID Verify Code

578 단어 신분증
public static char genSNVerifyCode(String sn) {
	char snSrc[] = sn.toCharArray();
	int iS = 0;
	int iW[] = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 };
	char verCode[] = new char[] { '1', '0', 'X', '9', '8', '7', '6', '5',
			'4', '3', '2' };
	for (int i = 0; i < 17; i++) {
		iS += (int) (snSrc[i] - '0') * iW[i];
	}
	int iY = iS % 11;
	return verCode[iY];
}

 
부록:

좋은 웹페이지 즐겨찾기