code: @Override
      public double d(double[] x, double[] y) {
          if (x.length != y.length)
              throw new IllegalArgumentException(String.format("Arrays have different length: x[%d], y[%d]", x.length, y.length));
  
          return 1 - Math.cor(x, y);
      }
docs: Pearson correlation  distance between the two arrays of type double.