Here you can find the source of computeDistance(final int[] position1, final int[] position2)
final public static float computeDistance(final int[] position1, final int[] position2)
//package com.java2s; public class Main { final public static float computeDistance(final int[] position1, final int[] position2) { float dist = 0; for (int d = 0; d < position1.length; ++d) { final int pos = position2[d] - position1[d]; dist += pos * pos;/*from ww w . ja v a 2 s . co m*/ } return (float) Math.sqrt(dist); } }