if (bounds == null) { if (npoints == 0) return bounds = new Rectangle(); int i = npoints - 1; int minx = xpoints[i]; int maxx = minx; int miny = ypoints[i]; int maxy = miny; while (--i >= 0) { int x = xpoints[i]; int y = ypoints[i]; if (x < minx) minx = x; else if (x > maxx) maxx = x; if (y < miny) miny = y; else if (y > maxy) maxy = y; } bounds = new Rectangle(minx, maxy, maxx - minx, maxy - miny); } return bounds;
return getBoundingBox ();
  public Rectangle getBounds()  {    if (bounds == null)      {        if (npoints == 0)          return bounds = new Rectangle();        int i = npoints - 1;        int minx = xpoints[i];        int maxx = minx;        int miny = ypoints[i];        int maxy = miny;        while (--i >= 0)          {            int x = xpoints[i];            int y = ypoints[i];            if (x < minx)              minx = x;            else if (x > maxx)              maxx = x;            if (y < miny)              miny = y;            else if (y > maxy)              maxy = y;          }        bounds = new Rectangle(minx, maxy, maxx - minx, maxy - miny);      }    return bounds;  }