title: first largest and second largest in this java code?
body: <p>I got the largest number and smallest number from the string. But how do I find second largest number  and third largest number in this java code from this problem? which code should i use? Please explain</p>
  
  <pre><code>public class Problem1
  {
  public static void main(String[] args) {
  int a[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
  // int b[] = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 };
  Problem1 app = new Problem1();
  app.scrambleArray(a);
  app.print(a);
  // Usage enable assertions: -ea to VM arguments
  int result = app.findInt(a, 10);
  assert (result == 10) :
  String.format("Expected &lt;10&gt; but was &lt;%d&gt;", result);
  result = app.findInt(a, 11);
  assert (result == -1) :
  String.format("Expected &lt;-1&gt; but was &lt;%d&gt;", result);
  System.out.printf("Largest Number is : %d%n", app.getMax(a));
  app.print(app.reverseArray(a));
  }
  public void scrambleArray(int[] a) {
  for (int i = 0; i &lt; a.length; i++) {
  int pos = new Random().nextInt(a.length);
  int tmp = a[i];
  a[i] = a[pos];
  a[pos] = tmp;
  }
  }
  public void print(int[] a) {
  System.out.println(Arrays.toString(a));
  }
  public int getMax(int[] a) {
  int max = a[0];
  for (int i = 1; i &lt; a.length; i++) {
  max = Math.max(a[i], max);
  }
  return max;
  }
  public int findInt(int[] a, int value) {
  int result = -1;
  for (int i : a) {
  if (value == i) {
  result = value;
  break;
  }
  }
  return result;
  }
  public int[] reverseArray(int[] a) {
  int[] results = new int[a.length];
  for (int i = 0, idx = a.length - 1; i &lt; a.length; i++, idx--) {
  results[i] = a[idx];
  }
  return results;
  }
  }
  </code></pre>