private static double distance(Point p1,Point p2){
  double d;
  d=(p1.x - p2.x) * (p1.x - p2.x);
  d+=(p1.y - p2.y) * (p1.y - p2.y);
  d=Math.sqrt(d);
  return d;
}

private static double distance ( Point p1 , Point p2 ) { double d ; d = ( p1 . x - p2 . x ) * ( p1 . x - p2 . x ) ; d += ( p1 . y - p2 . y ) * ( p1 . y - p2 . y ) ; d = Math . sqrt ( d ) ; return d ; }
calculates the distance between a pair of points .
