driver-core/src/main/com/mongodb/WriteConcern.java
public WriteConcern withW(final int w) {
        return new WriteConcern(Integer.valueOf(w), wTimeoutMS, fsync, journal);
    }
public WriteConcern withW(final int w) {
        return new WriteConcern(Integer.valueOf(w), wTimeoutMS, fsync, journal);
    }
Constructs a new WriteConcern from the current one and the specified integer-based value for w

@param w number of servers to ensure write propagation to before acknowledgment, which must be {@code >= 0}
@return the new WriteConcern
@mongodb.driver.manual core/write-concern/#replica-acknowledged Replica Acknowledged