Here you can find the source of distVector(double[] vector1, double[] vector2)
public static double distVector(double[] vector1, double[] vector2)
//package com.java2s; // it under the terms of the GNU Lesser General Public License as published by public class Main { public static double distVector(double[] vector1, double[] vector2) { int dim = vector1.length; double sum = 0; for (int n = 0; n < dim; n++) { sum += (vector1[n] - vector2[n]) * (vector1[n] - vector2[n]); }//w ww.ja v a 2s. co m return Math.sqrt(sum); } }