driver-legacy/src/main/com/mongodb/MongoOptions.java
@SuppressWarnings("deprecation")
    public WriteConcern getWriteConcern() {
        WriteConcern retVal;

        if (writeConcern != null) {
            retVal = writeConcern;
        } else if (w != 0 || wtimeout != 0 || fsync | j) {
            retVal = WriteConcern.ACKNOWLEDGED;
            if (w != 0) {
                retVal = retVal.withW(w);
            }
            if (wtimeout != 0) {
                retVal = retVal.withWTimeout(wtimeout, TimeUnit.MILLISECONDS);
            }
            if (fsync) {
                retVal = retVal.withFsync(fsync);
            }
            if (j) {
                retVal = retVal.withJ(j);
            }
        } else if (safe) {
            retVal = WriteConcern.ACKNOWLEDGED;
        } else {
            retVal = WriteConcern.UNACKNOWLEDGED;
        }
        return retVal;
    }
@SuppressWarnings("deprecation")
    public WriteConcern getWriteConcern() {
        WriteConcern retVal;

        if (writeConcern != null) {
            retVal = writeConcern;
        } else if (w != 0 || wtimeout != 0 || fsync | j) {
            retVal = WriteConcern.ACKNOWLEDGED;
            if (w != 0) {
                retVal = retVal.withW(w);
            }
            if (wtimeout != 0) {
                retVal = retVal.withWTimeout(wtimeout, TimeUnit.MILLISECONDS);
            }
            if (fsync) {
                retVal = retVal.withFsync(fsync);
            }
            if (j) {
                retVal = retVal.withJ(j);
            }
        } else if (safe) {
            retVal = WriteConcern.ACKNOWLEDGED;
        } else {
            retVal = WriteConcern.UNACKNOWLEDGED;
        }
        return retVal;
    }
Helper method to return the appropriate WriteConcern instance based on the current related options settings.

@return a WriteConcern for the current MongoOptions.