}
  public static double mean(double[] vector) {      double sum = 0;    if (vector.length == 0)      return 0;    for (int i = 0; i < vector.length; i++)       sum += vector[i];    return sum / (double) vector.length;  }