code: public static double max(double[] x) {
          double m = Double.NEGATIVE_INFINITY;
  
          for (double n : x) {
              if (n > m) {
                  m = n;
              }
          }
  
          return m;
      }
docs: Returns the maximum value of an array.