title: Java Comparator class to sort arrays
body: <p>Say, we have the following 2-dimensional array:</p>
  
  <pre><code>int camels[][] = new int[n][2];
  </code></pre>
  
  <p>How should Java <code>Comparator</code> class be declared to sort the arrays by their first elements in decreasing order using <code>Arrays.sort(camels, comparator)</code>? The <code>compare</code> function for reference is:</p>
  
  <pre><code>@Override public int compare(int[] a, int [] b)
  {
      return b[0] - a[0];
  }
  </code></pre>