If we can assume each token is space delimited and it is a non-Polish notation this will be sufficient:
Queue<Integer> numerals = new Queue<Integer>();
Queue<String> operators = new Queue<String>();
String[] tokens = input.split(" ");
int numeralIndex = 0;
for(String token:tokens)
{
if(numeralIndex %2 == 0)
{
numerals.enqueue(Integer.parseInt(token));
} else{
operators.enqueue(token);
}
numeralIndex++;
}
Now that you have the tokens in order you need to remove them from the queues to reassemble your initial calculation. You will also need the list of symbols so that you can correctly bind the statements:
int runningTotal = 0;
if(operator.equals("+")
{
runningTotal += (previous+current);
}else if(operator.equals("-")
{
runningTotal-=(previous-current);
} //etc
I will leave the rest as an exercise for your homework assignment.