### Question:
Spearman 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!"); } ValuePair sortedX[] = new ValuePair[x.length]; ValuePair sortedY[] = new ValuePair[y.length]; for (int i = 0; i < x.length; ++i) { sortedX[i] = new ValuePair(x[i], i); sortedY[i] = new ValuePair(y[i], i); if (Double.isNaN(x[i]) || Double.isNaN(y[i])) { System.out.println("STOP!"); } } try { Arrays.sort(sortedX); } catch (Exception e) { e.printStackTrace(); System.out.println(Arrays.toString(sortedX)); return -1; } try { Arrays.sort(sortedY); } catch (Exception e) { e.printStackTrace(); System.out.println(Arrays.toString(sortedY)); return -1; } double ranks1[] = createRanks(sortedX); double ranks2[] = createRanks(sortedY); return calculateRankCorrelationUsingRanks(ranks1, ranks2); }  double calculateRankCorrelation(final double x[], final double y[]);  }### Answer:
@Test public void test() { Spearman correlation = new Spearman(); Assert.assertEquals(expectedCorrelation, correlation.calculateRankCorrelation(x, y), DOUBLE_PRECISION_DELTA); }