code: public static void toGeojsonGeometry(Geometry geom, StringBuilder sb) {
          if (geom instanceof Point) {
              toGeojsonPoint((Point) geom, sb);
          } else if (geom instanceof LineString) {
              toGeojsonLineString((LineString) geom, sb);
          } else if (geom instanceof Polygon) {
              toGeojsonPolygon((Polygon) geom, sb);
          } else if (geom instanceof MultiPoint) {
              toGeojsonMultiPoint((MultiPoint) geom, sb);
          } else if (geom instanceof MultiLineString) {
              toGeojsonMultiLineString((MultiLineString) geom, sb);
          } else if (geom instanceof MultiPolygon) {
              toGeojsonMultiPolygon((MultiPolygon) geom, sb);
          } else {
              toGeojsonGeometryCollection((GeometryCollection) geom, sb);
          }
      }
docs: Transform a JTS geometry to a GeoJSON representation.
  
  @param geom
  @param sb