code: public static Polygon removeDuplicateCoordinates(Polygon polygon, double tolerance) throws SQLException {
          Coordinate[] shellCoords = CoordinateUtils.removeRepeatedCoordinates(polygon.getExteriorRing().getCoordinates(),tolerance,true);
          LinearRing shell = FACTORY.createLinearRing(shellCoords);
          ArrayList<LinearRing> holes = new ArrayList<LinearRing>();
          for (int i = 0; i < polygon.getNumInteriorRing(); i++) {
              Coordinate[] holeCoords = CoordinateUtils.removeRepeatedCoordinates(polygon.getInteriorRingN(i).getCoordinates(), tolerance, true);
              if (holeCoords.length < 4) {
                  throw new SQLException("Not enough coordinates to build a new LinearRing.\n Please adjust the tolerance");
              }
              holes.add(FACTORY.createLinearRing(holeCoords));
          }
          return FACTORY.createPolygon(shell, GeometryFactory.toLinearRingArray(holes));
      }
docs: Removes duplicated coordinates within a Polygon.
  
  @param polygon the input polygon
  @param tolerance to delete the coordinates
  @return
  @throws java.sql.SQLException