title: How to sort an arraylist into increasing order without using any existing sort methods in java?
body: <p>I need to sort an array of incoming integer values into increasing order, but I can't use any existing sort methods (so no Collections.sort(array)). </p>
  
  <pre><code>public void insert(Integer value) {
      for (int i = 0; i &lt; array.size(); i++) {
          array.add(value);
      }
  }
  </code></pre>
  
  <p>Here is my probably over complicated and failed attempt.</p>
  
  <pre><code>for (int i = 0; i &lt; array.size(); i++) {
      array.add(value);
  }
  
  if(array.size() &gt;= 2) {
      value2 = array.get(0);
      for(int j = 0; j &lt; array.size(); j++) {
          if(j != 0) {
              if(value2 &lt; array.get(j)) {
                  array.set(0, array.get(j));
                  array.set(j, value);
              }
          }
      }  
  }
  </code></pre>
  
  <p>Any help would be appreciated!</p>