public String evaluar(Stack stack){
        String pop,prueba1,prueba2;
        int num1,num2,cont;
        do{
           prueba1 = (String)stack.pop();
           prueba2 = (String)stack.pop();
           if(prueba2!=null){
                stack.push(prueba2);
                stack.push(prueba1);

                num1 = Integer.parseInt((String) stack.pop());

                num2 = Integer.parseInt((String)stack.pop());

                pop = (String)stack.pop();

                switch (pop){
                    case "+":{
                        num1 = num1+num2;
                        stack.push(Integer.toString(num1));
                        break;
                    }
                    case "-":{
                        num1 = num1-num2;
                        stack.push(Integer.toString(num1));
                        break;
                    }
                    case "*":{
                        num1 = num1*num2;
                        stack.push(Integer.toString(num1));
                        break;
                    }
                    case "/":{
                        if(num2!=0){
                             num1 = num1+num2;
                             stack.push(Integer.toString(num1));
                        }
                        break;
                    }
                }
           }
        }while(prueba2!=null);
        return prueba1;
    }