public static String convertToPostfix(String in) {
        StkChar opstk = new StkChar();
        StringBuffer out = new StringBuffer();
        String opers = "+-*/()";
        char topsym = '+';
        boolean empty;
        for (int i = 0; i < in.length(); i++) {
            if (opers.indexOf(in.charAt(i)) == -1) {
                out.append(in.charAt(i));
            } else {
                while (!(empty = opstk.isEmpty())
                        && precedence(topsym = opstk.pop(), in.charAt(i))) {
                    out.append(topsym);
                }
                if (!empty) {
                    opstk.push(topsym);
                }
                if (empty || in.charAt(i) != ')') {
                    opstk.push(in.charAt(i));
                } else {
                    topsym = opstk.pop();
                }
            }
        }
        while (!opstk.isEmpty()) {
            out.append(opstk.pop());
        }
        return out.toString();
    }