private static double distance(double x1,double y1,double x2,double y2){
  return Math.sqrt((y2 - y1) * (y2 - y1) + (x2 - x1) * (x2 - x1));
}

private static double distance ( double x1 , double y1 , double x2 , double y2 ) { return Math . sqrt ( ( y2 - y1 ) * ( y2 - y1 ) + ( x2 - x1 ) * ( x2 - x1 ) ) ; }
calculates the distance between two given points in the plane .
