@@ -0,0 +1,1394 @@
+package collection1;%0A%0Aimport java.util.Stack;%0A%0A/*%0A * Evaluate the value of an arithmetic expression in Reverse Polish Notation.%0A%0AValid operators are +, -, *, /. Each operand may be an integer or another expression.%0A%0ASome examples:%0A  %5B%222%22, %221%22, %22+%22, %223%22, %22*%22%5D -%3E ((2 + 1) * 3) -%3E 9%0A  %5B%224%22, %2213%22, %225%22, %22/%22, %22+%22%5D -%3E (4 + (13 / 5)) -%3E 6%0A */%0Apublic class ReversePolish %7B%0A%0A%09public static int evalRPN(String%5B%5D tokens) %7B%0A        Stack%3CString%3E st = new Stack%3CString%3E();%0A        for(int i = 0;i%3Ctokens.length;i++)%7B%0A        %09if(tokens%5Bi%5D.equals (%22+%22)%7C%7Ctokens%5Bi%5D.equals (%22-%22)%7C%7Ctokens%5Bi%5D.equals (%22*%22)%7C%7Ctokens%5Bi%5D.equals (%22/%22)) %7B%0A        %09%09int second = Integer.parseInt(st.pop());%0A        %09%09int first = Integer.parseInt(st.pop());%0A        %09%09if(tokens%5Bi%5D.equals (%22+%22)) %7B%0A        %09%09%09st.push((first+second)+%22%22);%0A        %09%09%7D else if(tokens%5Bi%5D.equals (%22-%22)) %7B%0A        %09%09%09st.push((first-second)+%22%22);%0A        %09%09%7D else if(tokens%5Bi%5D.equals (%22*%22)) %7B%0A        %09%09%09st.push((first*second)+%22%22);%0A        %09%09%7D else %7B%0A        %09%09%09st.push((first/second)+%22%22);%0A        %09%09%7D%0A        %09%7D%0A        %09else %7B%0A        %09%09st.push(tokens%5Bi%5D);%0A        %09%7D%0A        %7D%0A%09%09return Integer.parseInt(st.pop());%0A    %7D%0A%09public static void main(String%5B%5D args) %7B%0A%09%09// TODO Auto-generated method stub%0A%09%09String s= %22+%22;%0A%09%09%0A%09%09int a =1;%0A%09%09int b =2;%0A%09%09System.out.println(a/b);%0A%09%09%0A%09%09String%5B%5D arr = %7B%222%22, %221%22, %22+%22, %223%22, %22*%22%7D;%0A%09%09System.out.println(evalRPN(arr));%0A%09%7D%0A%0A%7D%0A

Create ReversePolish.java