code: public static void standardize(double[] a) {
      double m = mean(a);
      if (Double.isNaN(m))
        throw new RuntimeException("Can't standardize array whose mean is NaN");
      double s = stdev(a);
      if(s == 0.0 || Double.isNaN(s))
        throw new RuntimeException("Can't standardize array whose standard deviation is 0.0 or NaN");
      addInPlace(a, -m); // subtract mean
      multiplyInPlace(a, 1.0/s); // divide by standard deviation
    }
docs: Standardize values in this array, i.e., subtract the mean and divide by the standard deviation.
  If standard deviation is 0.0, throws an RuntimeException.