title: Finding the Minimum And Maximum in ArrayList w/o Sorting - Java
body: <p>I am trying to find the Minimum and Maximum Value in an ArrayList without Sorting:</p>
  
  <p>Here is my Current Attempt - However I cannot seem to be getting it to work properly:</p>
  
  <pre><code>import java.util.*;
  
  class Untitled {
      static ArrayList&lt;Integer&gt; al = new ArrayList&lt;Integer&gt;();
  
      public static void main(String[] args) {
  
          System.out.println(populateArray(al));
          System.out.println(findMin(al,0));
  
      }   
  
      public static ArrayList&lt;Integer&gt; populateArray(ArrayList&lt;Integer&gt; a) {
  
          al.add(1);
          al.add(2);
          al.add(30);
          al.add(3);
          al.add(13);
          al.add(34);
          al.add(4);
          al.add(3);
          al.add(2);
          al.add(1);
          al.add(93);
          return a;
      }
  
      public static int findMin(ArrayList&lt;Integer&gt; a, int start) {
          int min = start;
  
          for(int i=start; i&lt;a.size(); i++) {
              if(a.get(i) &lt; a.get(min)) {
                  min = i;
              }
          }
          return start;
      }
  }
  </code></pre>