public static double euclideanDistance(float[] p,float[] q){
  double ret=0;
  for (int i=0; i < p.length; i++) {
    double diff=(q[i] - p[i]);
    double sq=Math.pow(diff,2);
    ret+=sq;
  }
  return ret;
}

public static double euclideanDistance ( float [ ] p , float [ ] q ) { double ret = 0 ; for ( int i = 0 ; i < p . length ; i ++ ) { double diff = ( q [ i ] - p [ i ] ) ; double sq = Math . pow ( diff , 2 ) ; ret += sq ; } return ret ; }
this returns the euclidean distance of two vectors sum ( i = 1 , n ) ( q_i - p_i ) ^ 2
