### Question:
PearsonsSampleCorrelationCoefficient implements RankCorrelationCalculator { public double calculateRankCorrelation(final double x[], final double y[]) { if (x.length != y.length) { throw new IllegalArgumentException("The x and y array must have the same size!"); } if (x.length < 2) { throw new IllegalArgumentException("The x and y array must have a minimum size of 2!"); } int pairs = countValidPairs(x, y); if (pairs == 0) { return 0; } double averages[] = calculatePairedAverage(x, y); double variances[] = calculateCoVariances(x, averages[0], y, averages[1]); if (variances[0] == 0) { if (variances[1] == 0) { return 1; } else { return 0; } } if (variances[1] == 0) { return 0; } return variances[2] / (Math.sqrt(variances[0]) * Math.sqrt(variances[1])); }  double calculateRankCorrelation(final double x[], final double y[]);  }### Answer:
@Test public void test() { PearsonsSampleCorrelationCoefficient correl = new PearsonsSampleCorrelationCoefficient(); Assert.assertEquals(expectedCorrelation, correl.calculateRankCorrelation(x, y), DOUBLE_PRECISION_DELTA); }