private static float distance(float eventX,float startX,float eventY,float startY){
  float dx=eventX - startX;
  float dy=eventY - startY;
  return (float)Math.sqrt(dx * dx + dy * dy);
}

private static float distance ( float eventX , float startX , float eventY , float startY ) { float dx = eventX - startX ; float dy = eventY - startY ; return ( float ) Math . sqrt ( dx * dx + dy * dy ) ; }
returns the distance between two points
