### Question:
EuclideanDistance extends AbstractDistance { @Override public double calculate(final double[] position1, final int pos1, final double[] position2, final int pos2, final int length) { double sum = 0; for (int i = 0; i < length; i++) { final double d = position1[i + pos1] - position2[i + pos1]; sum += d * d; } return Math.sqrt(sum); }  @Override double calculate(final double[] position1, final int pos1, final double[] position2, final int pos2, final int length);  }### Answer:
@Test public void testDistanceCalc() { final CalculateDistance calc = new EuclideanDistance(); final double[] pos1 = {0.5, 1.0, 2.5,}; final double[] pos2 = {0.1, 2.0, -2.5,}; assertEquals(5.1146, calc.calculate(pos1, pos2), 0.001); }