title: Finding the largest value in an ArrayList
body: <p>I have two different functions for trying to find the largest value in an ArrayList.
  I have two since i was first seeing if they would return the same value and then performance time.</p>
  
  <p>However they are reproducing the same value but it seems to be the last value of the ArrayList, regardless if its the largest or not. I think it might be taking the key instead of the value.</p>
  
  <p>The code is below, and I think its just a simple mistake but can anyone point me in the right direction?</p>
  
  <pre><code>double highest = fitnessArray.get(0);
  
  for (int s = 0; s &lt;fitnessArray.size(); s++){
      if (fitnessArray.get(s)&gt;highest)
          highest=fitnessArray.get(s);
  
  }
  
  System.out.println("highest fitness = " + highest 
                  + " indoexOf = " + fitnessArray.indexOf(highest));
  </code></pre>
  
  <hr>
  
  <pre><code>double highestFitness;
  
  highestFitness = Collections.max(fitnessArray);
  System.out.println("lowest fitness 2 = " + highestFitness );
  </code></pre>