code: public PolygonOptions toPolygon(Polygon polygon) {
  
          PolygonOptions polygonOptions = new PolygonOptions();
  
          List<LineString> rings = polygon.getRings();
  
          if (!rings.isEmpty()) {
  
              Double z = null;
  
              // Add the polygon points
              LineString polygonLineString = rings.get(0);
  
              // Try to simplify the number of points in the polygon ring
              List<Point> points = simplifyPoints(polygonLineString.getPoints());
  
              for (Point point : points) {
                  LatLng latLng = toLatLng(point);
                  polygonOptions.add(latLng);
                  if (point.hasZ()) {
                      z = (z == null) ? point.getZ() : Math.max(z, point.getZ());
                  }
              }
  
              // Add the holes
              for (int i = 1; i < rings.size(); i++) {
                  LineString hole = rings.get(i);
  
                  // Try to simplify the number of points in the polygon hole
                  List<Point> holePoints = simplifyPoints(hole.getPoints());
  
                  List<LatLng> holeLatLngs = new ArrayList<LatLng>();
                  for (Point point : holePoints) {
                      LatLng latLng = toLatLng(point);
                      holeLatLngs.add(latLng);
                      if (point.hasZ()) {
                          z = (z == null) ? point.getZ() : Math.max(z,
                                  point.getZ());
                      }
                  }
                  polygonOptions.addHole(holeLatLngs);
              }
  
              if (polygon.hasZ() && z != null) {
                  polygonOptions.zIndex(z.floatValue());
              }
          }
  
          return polygonOptions;
      }
docs: Convert a {@link Polygon} to a {@link PolygonOptions}
  
  @param polygon polygon
  @return polygon options