code: public static Geometry removeDuplicateCoordinates(Geometry geom, double tolerance) throws SQLException {
          if (geom == null) {
              return null;
          } else if (geom.isEmpty()) {
              return geom;
          } else if (geom instanceof Point) {
              return geom;
          } else if (geom instanceof MultiPoint) {
              return geom;
          } else if (geom instanceof LineString) {
              return removeDuplicateCoordinates((LineString) geom, tolerance);
          } else if (geom instanceof MultiLineString) {
              return removeDuplicateCoordinates((MultiLineString) geom, tolerance);
          } else if (geom instanceof Polygon) {
              return removeDuplicateCoordinates((Polygon) geom, tolerance);
          } else if (geom instanceof MultiPolygon) {
              return removeDuplicateCoordinates((MultiPolygon) geom, tolerance);
          } else if (geom instanceof GeometryCollection) {
              return removeDuplicateCoordinates((GeometryCollection) geom, tolerance);
          }
          return null;
      }
docs: Removes duplicated points within a geometry.
  
  @param geom
  @param tolerance to delete the coordinates
  @return
  @throws java.sql.SQLException