title: How to sort a 2D array in increasing order? Java
body: <p>I have a test tomorrow where we write a code based on what is asked. I need some explanation on how to sort a 2D array in increasing order. I can do this for a 1D array but I'm not sure if the same code will work for the 2D. Can you just explain how to implement this for a 2D array in your own way, I don't want you to think this is for homework, I just need to know how to do this for a test tomorrow. Thanks</p>
  
  <pre><code>for (i = 0; i &lt; a.length - 1; i++) {
   for (j = i+1; j &lt; a[0].length; j++) {
        if (a[i] &lt; a[j]) {
             int temp = a[i];
             a[i] = a[j];
             a[j] = temp;
             System.out.print(temp);
        }
   }
  </code></pre>
  
  <p>}</p>