Here you can find the source of distance(float[] values1, float[] values2)
public static double distance(float[] values1, float[] values2)
//package com.java2s; //License from project: Open Source License public class Main { public static double distance(float[] values1, float[] values2) { if (values1 != null && values2 != null) { if (values1.length == values2.length) { float sum = 0; for (int i = 0; i < values1.length; i++) { sum += (values2[i] - values1[i]) * (values2[i] - values1[i]); }// w w w.j a v a 2s. com return Math.sqrt(sum); } } return -1; } }