Here you can find the source of euclidean(double[] x1, double[] x2)
public static double euclidean(double[] x1, double[] x2)
//package com.java2s; //License from project: Open Source License public class Main { public static double euclidean(double[] x1, double[] x2) { double[] x3 = arraySubtract(x1, x2); double result = 0; for (double x : x3) if (x != 0) result += x * x;/* w w w .j a va 2s . c o m*/ return Math.pow(result, 0.5); } public static double[] arraySubtract(double[] x1, double[] x2) { double[] result = new double[x1.length]; for (int i = 0; i < x1.length; i++) { result[i] = x1[i] - x2[i]; } return result; } }