code: public static int distance (int x1, int y1, int x2, int y2)
      {
          int dx = x1-x2, dy = y1-y2;
          return (int)Math.sqrt(dx*dx+dy*dy);
      }
docs: Computes the geometric distance between the supplied two points.