Write a method that takes an array of integers as a parameter and returns the maximum value stored in the array. Return 0 if the array has no elements.
   private static int max(int[] list) {
      int max;
      if (list.length == 0)
         return 0;
      max = list[0];
      for (int i=1;i<list.length;i++)
         if (max < list[i])
         max = list[i];
      return max;
   }