pseudo-code which needs revising/reworking (I've written actual code, but it's fairly confusing...)
solveParentheses(String[] equation):
loop until no more parentheses:
find first parenthesis
store its location in a variable
find close parenthesis
store its location in a variable
If found one but not the other, give error message
save the content of the parentheses into an array
that array = solveParentheses(that array)
simplify order of ops inside parentheses
set the location of end parenthesis to result of simplification
set indices between the first parenthesis and result to "null"
:end loop
count number of null values
new array of length equation.length-nullcounter
fill array with non-null values
return array
:end function