سلام دوستان من یک کدی تو اینترنت پیدا کردم که با سی شارپ نوشته شده البته خودم کد رو تبدیل به java کردم ولی همش میده صحیح است من کد سی شارپ و جاوا رو میزارم لطفا اگر نیاز به ویرایش داره یا کد دیگری دارید پست کنید
کد PHP:
public void meli(){    EditText tld=(EditText)findViewById(R.id.uname);    char[] chArray tld.getText().toString().toCharArray();    int[] numArray = new int[chArray.length];    for (int i 0chArray.lengthi++)    {        numArray[i] = (int)Character.forDigit(chArray[i],100);    }    int num2 numArray[9];    switch (tld.getText().toString())    {        case "0000000000":            Toast.makeText(getApplicationContext(),"غلط",To  ast.LENGTH_SHORT).show();            break;        case "1111111111":            Toast.makeText(getApplicationContext(),"غلط",To  ast.LENGTH_SHORT).show();            break;        case "22222222222":            Toast.makeText(getApplicationContext(),"غلط",To  ast.LENGTH_SHORT).show();            break;        case "33333333333":            Toast.makeText(getApplicationContext(),"غلط",To  ast.LENGTH_SHORT).show();            break;        case "4444444444":            Toast.makeText(getApplicationContext(),"غلط",To  ast.LENGTH_SHORT).show();            break;        case "5555555555":            Toast.makeText(getApplicationContext(),"غلط",To  ast.LENGTH_SHORT).show();            break;        case "6666666666":Toast.makeText(getApplicationContext(  ),"غلط",Toast.LENGTH_SHORT).show();            break;        case "7777777777":            Toast.makeText(getApplicationContext(),"غلط",To  ast.LENGTH_SHORT).show();            break;        case "8888888888":            Toast.makeText(getApplicationContext(),"غلط",To  ast.LENGTH_SHORT).show();            break;        case "9999999999":            Toast.makeText(getApplicationContext(),"غلط",To  ast.LENGTH_SHORT).show();            break;    }    int num3 = ((((((((numArray[0] * 10) + (numArray[1] * 9)) + (numArray[2] * 8)) + (numArray[3] * 7)) + (numArray[4] * 6)) + (numArray[5] * 5)) + (numArray[6] * 4)) + (numArray[7] * 3)) + (numArray[8] * 2);    int num4 num3 - ((num3 11) * 11);    if ((((num4 == 0) && (num2 == num4)) || ((num4 == 1) && (num2 == 1))) || ((num4 1) && (num2 == Math.abs((int)(num4 11)))))    {        Toast.makeText(getApplicationContext(),"صحیح",  Toast.LENGTH_SHORT).show();    }    else    {        Toast.makeText(getApplicationContext(),"غلط",To  ast.LENGTH_SHORT).show();
    } 
کد PHP:
char[] chArray this.textBox1.Text.ToCharArray();                int[] numArray = new int[chArray.Length];                for (int i 0chArray.Lengthi++)                {                    numArray[i] = (int)char.GetNumericValue(chArray[i]);                }                int num2 numArray[9];                switch (this.textBox1.Text)                {                    case "0000000000":                    case "1111111111":                    case "22222222222":                    case "33333333333":                    case "4444444444":                    case "5555555555":                    case "6666666666":                    case "7777777777":                    case "8888888888":                    case "9999999999":                        MessageBox.Show("کد ملی وارد شده صحیح نمی باشد");                        break;                }                int num3 = ((((((((numArray[0] * 10) + (numArray[1] * 9)) + (numArray[2] * 8)) + (numArray[3] * 7)) + (numArray[4] * 6)) + (numArray[5] * 5)) + (numArray[6] * 4)) + (numArray[7] * 3)) + (numArray[8] * 2);                int num4 num3 - ((num3 11) * 11);                if ((((num4 == 0) && (num2 == num4)) || ((num4 == 1) && (num2 == 1))) || ((num4 1) && (num2 == Math.Abs((int)(num4 11)))))                {                    MessageBox.Show("کد ملی صحیح می باشد");                }                else                {                    MessageBox.Show("کد ملی نامعتبر است");                }