Question: I have one edittext and for example I put in12345. I want to check if the first two numbers' sum is >0 then do something. I don't know how to check first two elements' sum.

```
if(pirinfouserid.getText().toString().indexOf(2)>0)
        Toast.makeText(getApplicationContext(), "ok",
                Toast.LENGTH_SHORT).show();
    else
        Toast.makeText(getApplicationContext(), "wrong",
                Toast.LENGTH_SHORT).show();

```

If anyone knows a solution please help me

Thanks

Answer: 
```
int num1=Integer.parseInt(pirinfouserid.getText().toString().charAt(0));
int num2=Integer.parseInt(pirinfouserid.getText().toString().charAt(1));
int sum=num1+num2;
if(sum>0)
    Toast.makeText(getApplicationContext(), "ok",
            Toast.LENGTH_SHORT).show();
else
    Toast.makeText(getApplicationContext(), "wrong",
            Toast.LENGTH_SHORT).show();

```
```
String input = pirinifouserid.getText().toString();

int firstNumber = Integer.parseInt(input.substring(0,1));
int secondNumber = Integer.parseInt(input.substring(1,2));
int sum = firstNumber + secondNumber;

if (sum > 0) ...

```