title: How to find second largest number in an array in Java?
body: <p>I'm just practicing some MIT java assignments. But, I'm not sure how to find the second largest number. <a href="http://ocw.csail.mit.edu/f/13" rel="nofollow">http://ocw.csail.mit.edu/f/13</a></p>
  
  <pre><code>  public class Marathon {
      public static void main(String[] arguments) {
          String[] names = { "Elena", "Thomas", "Hamilton", "Suzie", "Phil",
                  "Matt", "Alex", "Emma", "John", "James", "Jane", "Emily",
                  "Daniel", "Neda", "Aaron", "Kate" };
  
          int[] times = { 341, 273, 278, 329, 445, 402, 388, 275, 243, 334, 412,
                  393, 299, 343, 317, 265 };
  
          for (int i = 0; i &lt; names.length; i++) {
              System.out.println(names[i] + ": " + times[i]);
          }
  
          System.out.println();
          System.out.println("Largest Timing " + Largest(times));
          System.out.println();
  
      }
  
      public static int Largest(int[] times) {
          int maxValue = times[0];
  
          for (int i = 1; i &lt; times.length; i++) {
              if (times[i] &gt; maxValue) {
                  maxValue = times[i];
              }
          }
          return maxValue;
      }
  
  }
  </code></pre>