Here you can find the source of euclidean_distance(double[] vec1, double[] vec2)
public static double euclidean_distance(double[] vec1, double[] vec2)
//package com.java2s; //License from project: Apache License public class Main { public static double euclidean_distance(double[] vec1, double[] vec2) { double dist = 0; for (int i = 0; i < vec1.length && i < vec2.length; i++) dist += Math.pow(vec1[i] - vec2[i], 2); dist = Math.sqrt(dist);/*from w ww . j a va 2s. co m*/ return dist; } }