title: Finding minimum and maximum in Java 2D array
body: <p>I have been trying to figure this out for a while and need some help. I need to find the min/max values and print them out for a multidimensional array. Here are the two ways that I have tried.</p>
  
  <pre><code>import java.util.*;
  
  class MinMax {
      public static void main(String[] args) {
          int[][] data = {{3, 2, 5},
                  {1, 4, 4, 8, 13},
                  {9, 1, 0, 2},
                  {0, 2, 6, 3, -1, -8}};
          Arrays.sort(data);
          System.out.println("Minimum = " + data[0]);
          System.out.println("Maximum = " + data[data.length - 1]);
      }
  }
  </code></pre>
  
  <p>This version complies but doesn't run.</p>
  
  <pre><code>import java.util.*;
  
  class MinMax {
      public static void main(String[] args) {
          int[][] data = {{3, 2, 5},
                  {1, 4, 4, 8, 13},
                  {9, 1, 0, 2},
                  {0, 2, 6, 3, -1, -8}};
  
      public static int getMaxValue(int[] numbers) {
          int maxValue = numbers[0];
          for (int i = 1; i &lt; numbers.length; i++) {
              if (numbers[i] &gt; maxValue) {
                  maxValue = numbers[i];
              }
              return maxValue;
              {
                  public static int getMinValue (int[] numbers) {
                      int minValue = numbers[0];
                      for (int i = 1; i &lt; numbers.length; i++) {
                          if (numbers[i] &lt; minValue) {
                              minValue = numbers[i];
                          }
                      }
                  return minValue;
              }
  </code></pre>
  
  <p>This version just throws me a bunch of errors in compiling. Any help is greatly appreciated.</p>