title: How to do sorting in array list without using collections in Java
body: <pre><code>ArrayList &lt; Integer &gt; arraylist = new ArrayList &lt; Integer &gt; ();
  
  arraylist.add(10010);
  arraylist.add(5);
  arraylist.add(4);
  arraylist.add(2);
  
  for (int i = 0; i &lt; arraylist.size(); i++) {
  
      for (int j = arraylist.size() - 1; j &gt; i; j--) {
          if (arraylist.get(i) &gt; arraylist.get(j)) {
  
              int tmp = arraylist.get(i);
              arraylist.get(i) = arraylist.get(i);
              arraylist.get(j) = tmp;
  
          }
  
      }
  
  }
  for (int i: arraylist) {
      System.out.println(i);
  }
  </code></pre>
  
  <p>It is giving error while swapping, The LHS should be variable. I understand it.
  Set method works here but I do not want to use.
  Is there a way to do it without using set method? 
  Help is really appreciated.</p>