public static void postfix(String postfixInput)
    {
        int result = 0;
        int val = 0;
        int var1 = 0;
        int var2 = 0;
        char ch = ' ';
        
        Stack s = new Stack();
        
        for (int i = 0; i < postfixInput.length(); i++) {
            ch = postfixInput.charAt(i);
            val = ch - '0';
            
            if(val >=0 && val <9)
            {
                s.push(val);
            }
            else
            {
                var1 = (int)s.pop();
                var2 = (int)s.pop();
                
                switch(ch)
                {
                    case '+':
                        result = var1 + var2;
                        break;
                    case '-':
                        result = var1 - var2;
                        break;
                    case '/':
                        result = var1 / var2;
                        break;
                    case '*':
                        result = var1 * var2;
                        break;
                    default:
                        result = 0;
                        System.out.println("Invalid characterr encountered!!");
                        break;
                }
                s.push(result);
            }
        }
        result = (int)s.pop();
        System.out.println("The result of postfix " + postfixInput + " is: " + result);
            
    }