title: Finding an index of an array, then finding the value based off that index
body: <p>I'm trying to increment through my list with the i value, which represents the index of the array, I then need to find the value based off that index.</p>
  
  <p>I've tried assigning the value of what I'm looking for as -2, then incrementing through the list in order to find the index. But im not entirely sure as to how I get the actual value from the index. <code>studentId</code> isn't what I intended to return, but what it said when I tried returning was it must be an integer. Would someone please be able to show me how to successfully get a value from indexing through a list? </p>
  
  <pre class="lang-java prettyprint-override"><code>public int studentfinder( int list[]  ,  int studentId  )
  { 
      int correct = -2; 
      for (int i = 0;i&lt;array.length;i++)
      {
          if (list[i] == correct)
          {
              return studentId;
          }
          else
          {
              studentId = -1;
              return studentId;
          }
      }
  }
  </code></pre>
  
  <p>This method must return a result of type <code>int</code></p>