code: public static Shape generatePolygon(int sides, int outsideRadius, int insideRadius) {
          if (sides < 3) {
              return new Ellipse2D.Float(0, 0, 10, 10);
          }
  
          AffineTransform trans = new AffineTransform();
          Polygon poly = new Polygon();
          for (int i = 0; i < sides; i++) {
              trans.rotate(Math.PI * 2 / sides / 2);
              Point2D out = trans.transform(new Point2D.Float(0, outsideRadius), null);
              poly.addPoint((int) out.getX(), (int) out.getY());
              trans.rotate(Math.PI * 2 / sides / 2);
              if (insideRadius > 0) {
                  Point2D in = trans.transform(new Point2D.Float(0, insideRadius), null);
                  poly.addPoint((int) in.getX(), (int) in.getY());
              }
          }
  
          return poly;
      }
docs: Generates a polygon
  @param sides number of sides
  @param outsideRadius the outside radius
  @param insideRadius the inside radius
  @return the generated shape