### Question:
Correlation { public static double correlateMeanCenteredData(double[] x, double[] y, double varX, double varY) { double covarianceInterim = 0; for (int i = 0; i < x.length; i++) { covarianceInterim += x[i] * y[i]; } return (covarianceInterim / (x.length - 1)) / Math.sqrt(varX * varY); }  static double rankCorrelate(double[] x, double[] y); static void correlationToZScore(int maxNrSamples, int granularity); static void correlationToZScore(int maxNrSamples); static double correlateMeanCenteredData(double[] x, double[] y, double varX, double varY); static double correlateMeanCenteredData(double[] x, double[] y, double sdXsdY); static double correlate(double[] x, double[] y); static double correlate(double meanX, double meanY, double[] x, double[] y); static double covariate(double[] x, double[] y); static double covariate(double meanX, double meanY, double[] x, double[] y); static double convertCorrelationToZScore(int length, double correlation); static double correlate(double[] a1, double[] a2, double mean1, double mean2, double var1, double var2); static double correlate(DoubleMatrix1D x, DoubleMatrix1D y); static double[][] m_correlationToZScore; }### Answer:
@Test public void testCorrelateMeanCenteredData_3args() { System.out.println("correlateMeanCenteredData"); double[] x = new double[]{4.5, -0.5, -1.5, -2.5}; double[] y = new double[]{5,7,6,2}; double varX = 3.109126; double varY = 2.160247; double sdXsdY = varX * varY; double expResult = 0.2481458; double result = Correlation.correlateMeanCenteredData(x, y, sdXsdY); assertEquals(result, expResult, 0.000001); }