title: Java arrays returning highest array index
body: <p>I am supposed to write a program that finds the largest index in an unsorted array of integers.</p>
  
  <blockquote>
    <p>Use a method that takes an array of integers as a parameter. The method should search the array and return the index of the largest value.</p>
  </blockquote>
  
  <p>So i wrote a program that returns the highest value, for example it returns 13 as the highest number instead of the index of 2. So how would i return the index instead of the highest number itself? If that is an easy fix, does the rest of my code look correct? Thanks!</p>
  
  <pre><code>public class LargestInteger 
  {
      public static void main(String[] args)
      {
          int[] largeArray = {5,4,13,7,7,8,9,10,5};
  
          System.out.println(findLargest(largeArray));
      }
  
      public static int findLargest(int array[])
      {
          int largest = array[0];
  
          for(int i = 0; i &lt; array.length; i++)
          {
              if(array[i] &gt; largest)
                  largest = array[i];   
          }
  
          return largest;
      }
  }
  </code></pre>