code: public static Geometry precisionReducer(Geometry geometry, int nbDec) throws SQLException {
          if(geometry == null){
              return null;
          }
          if (nbDec < 0) {
              throw new SQLException("Decimal_places has to be >= 0.");
          }
          PrecisionModel pm = new PrecisionModel(scaleFactorForDecimalPlaces(nbDec));
          GeometryPrecisionReducer geometryPrecisionReducer = new GeometryPrecisionReducer(pm);
          return geometryPrecisionReducer.reduce(geometry);
      }
docs: Reduce the geometry precision. Decimal_Place is the number of decimals to
  keep.
  
  @param geometry
  @param nbDec
  @return
  @throws SQLException