assuming that string1 is your whole operation
use mdas
double result;
string recurAndCheck(string operation){
if(operation.indexOf("/")){
String leftSide = recurAndCheck(operation.split("/")[0]);
string rightSide = recurAndCheck(operation.split("/")[1]);
result = Double.parseDouble(leftSide)/Double.parseDouble(rightSide);
} else if (..continue w/ *...) {
//same as above but change / with *
} else if (..continue w/ -) {
//change as above but change with -
} else if (..continuew with +) {
//change with add
} else {
return;
}
}