I would let the framework and other libraries do the work for me. In case this is an academical thing, I would suggest going with the solution provided by Lai Vung.
Use the ScriptManager that will do the parsing and calculating for you, then convert the output to the needed type. Quick demo:
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
public class Main {
public static void main(String[] args) throws ScriptException {
String question;
int answer;
question = "7/7+9-9*5/5";
ScriptEngineManager mgr = new ScriptEngineManager();
ScriptEngine engine = mgr.getEngineByName("JavaScript");
answer = ((Number)engine.eval(question)).intValue();
}
}
Worth being mentioned: if android does not offer support for the Script engine probably you have to add the ScriptEngine library to your path. A good post explaining how to use Android and Rhino can be found here.