title: Search array for highest value, even if a tie
body: <p>I have two arrays:</p>
  
  <pre><code>String [] nameArr = new String[10];
  double [] totalArr = new double[10];
  </code></pre>
  
  <p><code>nameArr</code> contains names of people, and <code>totalArr</code> contains the amounts those people raised in a fundraiser. I want to get the name of the person or persons who raised the most money. Some pseudocode to illustrate:</p>
  
  <pre><code>int winner = array_maximum(totalArr); //would return array element 0-9
  //winner = 4 if totalArr[4] has the highest value
  </code></pre>
  
  <p>So I can then do something like:</p>
  
  <pre><code>String winPerson = nameArr[winner];
  System.out.println(winPerson);
  </code></pre>
  
  <p>I'm sure the method to do this doesn't involve returning the array element number, but this is just a way I figure it could potentially work. Does there exist such a method in Java to do what I want? What if there is a tie?</p>
  
  <p>Here's some rough work I did, still testing:</p>
  
  <pre><code>private String winner() {
      int i;
      double tentativeMaximum = totalArr[0];
      String winningPersons = nameArr[0];
      for (i = 1; i &lt; totalArr.length; i++) {
          if (totalArr[i] &gt; tentativeMaximum) {
              winningPersons = nameArr[i];
              tentativeMaximum = totalArr[i];
          } else if (totalArr[i] == tentativeMaximum) {
              winningPersons = winningPersons + " plus " + nameArr[i];
          }
      }
      winningPersons = winningPersons + " has won";
      return winningPersons;
  }
  </code></pre>