public static boolean validateTWCard(String idCard) {
        String start = idCard.substring(0, 1);
        String mid = idCard.substring(1, 9);
        String end = idCard.substring(9, 10);
        Integer iStart = twFirstCode.get(start);
        Integer sum = iStart / 10 + (iStart % 10) * 9;
        char[] chars = mid.toCharArray();
        Integer iflag = 8;
        for (char c : chars) {
            sum = sum + Integer.valueOf(c + "") * iflag;
            iflag--;
        }
        return (sum % 10 == 0 ? 0 : (10 - sum % 10)) == Integer.valueOf(end);
    }
public static boolean validateTWCard(String idCard) {
        String start = idCard.substring(0, 1);
        String mid = idCard.substring(1, 9);
        String end = idCard.substring(9, 10);
        Integer iStart = twFirstCode.get(start);
        Integer sum = iStart / 10 + (iStart % 10) * 9;
        char[] chars = mid.toCharArray();
        Integer iflag = 8;
        for (char c : chars) {
            sum = sum + Integer.valueOf(c + "") * iflag;
            iflag--;
        }
        return (sum % 10 == 0 ? 0 : (10 - sum % 10)) == Integer.valueOf(end);
    }
public static boolean validateTWCard ( String idCard ) { String start = idCard . substring ( 0 , 1 ) ; String mid = idCard . substring ( 1 , 9 ) ; String end = idCard . substring ( 9 , 10 ) ; Integer iStart = twFirstCode . get ( start ) ; Integer sum = iStart / 10 + ( iStart % 10 ) * 9 ; char [ ] chars = mid . toCharArray ( ) ; Integer iflag = 8 ; for ( char c : chars ) { sum = sum + Integer . valueOf ( c + "" ) * iflag ; iflag -- ; } return ( sum % 10 == 0 ? 0 : ( 10 - sum % 10 ) ) == Integer . valueOf ( end ) ; }
验证台湾身份证号码

@param idCard 身份证号码
@return 验证码是否符合
验证台湾身份证号码