code: public static void toGeojsonMultiPolygon(MultiPolygon multiPolygon, StringBuilder sb) {
          sb.append("{\"type\":\"MultiPolygon\",\"coordinates\":[");
  
          for (int i = 0; i < multiPolygon.getNumGeometries(); i++) {
              Polygon p = (Polygon) multiPolygon.getGeometryN(i);
              sb.append("[");
              //Process exterior ring
              toGeojsonCoordinates(p.getExteriorRing().getCoordinates(), sb);
              //Process interior rings
              for (int j = 0; j < p.getNumInteriorRing(); j++) {
                  sb.append(",");
                  toGeojsonCoordinates(p.getInteriorRingN(j).getCoordinates(), sb);
              }
              sb.append("]");
              if (i < multiPolygon.getNumGeometries() - 1) {
                  sb.append(",");
              }
          }
          sb.append("]}");
      }
docs: Coordinates of a MultiPolygon are an array of Polygon coordinate arrays.
  
  Syntax:
  
  { "type": "MultiPolygon", "coordinates": [ [[[102.0, 2.0], [103.0, 2.0],
  [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]], [[[100.0, 0.0], [101.0, 0.0],
  [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], [[100.2, 0.2], [100.8, 0.2],
  [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]] ] }
  
  @param multiPolygon
  @param sb