public static int evaluate(String [] expr) {
        LinkedList<String> stack = new LinkedList<>();
        String operators = "+-*/";
        for(String symbol : expr ) {
           if(!operators.contains(symbol)) {
               stack.push(symbol);
           } else {
               if(stack.size() >=2) {
                  int operand1 = Integer.parseInt(stack.pop());
                  int operand2 = Integer.parseInt(stack.pop());
                  int operatorIndex = operators.indexOf(symbol);
                   switch(operatorIndex) {
                      case 0 : stack.push(String.valueOf(operand1 + operand2));
                          break;
                      case 1 : stack.push(String.valueOf(operand1 - operand2));
                           break;
                       case 2 : stack.push(String.valueOf(operand1 * operand2));
                           break;
                       case 3 : stack.push(String.valueOf(operand1 / operand2));
                           break;
                      default: break;
                  }
               }
           }
        }

        return stack.size() == 1 ? Integer.parseInt(stack.pop()): -1;
    }