code: public short adjustReplication(short replication) {
      short r = (short) (replication < minReplication? minReplication
          : replication > maxReplication? maxReplication: replication);
      return r;
    }
docs: Clamp the specified replication between the minimum and the maximum
  replication levels.