Here you can find the source of distance(final double[] t1, final double[] t2)
public static double distance(final double[] t1, final double[] t2)
//package com.java2s; /**/*from ww w . ja v a 2s. co m*/ * Copyright? 2014-2016 LIST (Luxembourg Institute of Science and Technology), all right reserved. * Authorship : Olivier PARISOT, Yoanne DIDRY * Licensed under GNU General Public License version 3 */ public class Main { public static double distance(final double[] t1, final double[] t2) { if (t1.length != t2.length) throw new IllegalStateException("distance() -> " + t1.length + "<>" + t2.length); double sum = 0d; for (int i = 0; i < t1.length; i += 1) { sum += (t1[i] - t2[i]) * (t1[i] - t2[i]); } return Math.sqrt(sum); } }