Java

public static double calculateDistance(double[] array1, double[] array2) { double Sum = 0.0; for(int i=0;i<array1.length;i++) { Sum = Sum + Math.pow((array1[i]-array2[i]),2.0); } return Math.sqrt(Sum); }

You had syntactic and semantic errors.

Make sure, that both arrays have same number of elements.