public boolean getValidPid(String resident_no)
{
if ( resident_no.length() == 13 )
{
int num1 = Integer.parseInt(resident_no.charAt(0) + "");
int num2 = Integer.parseInt(resident_no.charAt(1) + "");
int num3 = Integer.parseInt(resident_no.charAt(2) + "");
int num4 = Integer.parseInt(resident_no.charAt(3) + "");
int num5 = Integer.parseInt(resident_no.charAt(4) + "");
int num6 = Integer.parseInt(resident_no.charAt(5) + "");
int num7 = Integer.parseInt(resident_no.charAt(6) + "");
int num8 = Integer.parseInt(resident_no.charAt(7) + "");
int num9 = Integer.parseInt(resident_no.charAt(8) + "");
int num10 = Integer.parseInt(resident_no.charAt(9) + "");
int num11 = Integer.parseInt(resident_no.charAt(10) + "");
int num12 = Integer.parseInt(resident_no.charAt(11) + "");
int num13 = Integer.parseInt(resident_no.charAt(12) + "");
int total = (num1 * 2) + (num2 * 3) + (num3 * 4) + (num4 * 5)
+ (num5 * 6) + (num6 * 7) + (num7 * 8) + (num8 * 9)
+ (num9 * 2) + (num10 * 3) + (num11 * 4) + (num12 * 5);
total = ( 11 - (total % 11) ) % 10;
if ( total == num13 )
return true;
else
return false;
}
else
{
return false;
}
}