title: Expression Solver Algorithm with Java
body: <p>I am trying to create a program that will take in an expression as a String and solve it. So if the input is  3 + 5 it would return 8. I have done majority of the coding, but I'm not sure why I keep getting an UnsupportedOperationExpression in Java. Please help if you can! </p>
  
  <p>** Also I have to use ArrayLists on this assignment because I have not yet learned lists. Here is my current code so far: </p>
  
  <pre><code>    import java.util.Arrays;
  import java.util.List;
  import java.util.ArrayList;
  
  public class FirstPart {
     public static void main(String[] args) {
        String sampleString = "1 + 2 + 3 / 2 + 1";
        String[] items = sampleString.split(" ");
        List&lt;String&gt; itemList = Arrays.asList(items);
        System.out.println(itemList);
        for(int zz=0; zz&lt;itemList.size(); zz++)
          if(itemList.get(zz).equals("*"))
             {itemList.set(zz-1,Integer.toString((Integer.parseInt(itemList.get(zz-1))*Integer.parseInt(itemList.get(zz+1)))));
             itemList.remove(zz+1);
             itemList.remove(zz);
             zz--;}
          else if(itemList.get(zz).equals("/"))
             {itemList.set(zz-1,Integer.toString((Integer.parseInt(itemList.get(zz-1))/Integer.parseInt(itemList.get(zz+1)))));
             itemList.remove(zz+1);
             itemList.remove(zz);
             zz--;}
        for(int zz=0; zz&lt;itemList.size(); zz++)
          if(itemList.get(zz).equals("+"))
             {itemList.set(zz-1,Integer.toString((Integer.parseInt(itemList.get(zz-1))+Integer.parseInt(itemList.get(zz+1)))));
             itemList.remove(zz+1);
             itemList.remove(zz);
             zz--;}
          else if(itemList.get(zz).equals("-"))
             {itemList.set(zz-1,Integer.toString((Integer.parseInt(itemList.get(zz-1))+Integer.parseInt(itemList.get(zz+1)))));
             itemList.remove(zz+1);
             itemList.remove(zz);
             zz--;}
        System.out.println(itemList);
     }
     }
  </code></pre>
  
  <p>Thanks again if you can help!</p>