code: public static Geometry getGeometryN(Geometry geometry, Integer n) throws SQLException {
          if (geometry == null) {
              return null;
          }
          if (n >= 1 && n <= geometry.getNumGeometries()) {
              return geometry.getGeometryN(n - 1);
          } else {
              throw new SQLException(OUT_OF_BOUNDS_ERR_MESSAGE);
          }
      }
docs: Return Geometry number n from the given GeometryCollection.
  
  @param geometry GeometryCollection
  @param n        Index of Geometry number n in [1-N]
  @return Geometry number n or Null if parameter is null.
  @throws SQLException