We assume that input is a valid postfix and expect an operator .
else { String op1 = s . peek ( ) ; s . pop ( ) ; String op2 = s . peek ( ) ; s . pop ( ) ; s . push ( " ( " + op2 + exp . charAt ( i ) + op1 + " ) " ) ; } }