code: final public void maskWriteRegister(int serverAddress, int startAddress, int and, int or) throws
              ModbusProtocolException, ModbusNumberException, ModbusIOException {
          processRequest(ModbusRequestBuilder.getInstance().buildMaskWriteRegister(serverAddress, startAddress, and, or));
      }
docs: This function code is used to modify the contents of a specified holding register using a
  combination of an AND mask, an OR mask, and the register's current contents. The function
  can be used to set or clear individual bits in the register.
  The request specifies the holding register to be written, the data to be used as the AND
  mask, and the data to be used as the OR mask. Registers are addressed starting at zero.
  Therefore registers 1-16 are addressed as 0-15.
  The function’s algorithm is:
  Result = (Current Contents AND And_Mask) OR (Or_Mask AND (NOT And_Mask))
  For example:
  Hex Binary
  Current Contents=    12  0001 0010
  And_Mask =           F2  1111 0010
  Or_Mask =            25  0010 0101
  <p>
  (NOT And_Mask)=      0D  0000 1101
  <p>
  Result =             17  0001 0111
  <p>
  Note:
  y If the Or_Mask value is zero, the result is simply the logical ANDing of the current contents and
  And_Mask. If the And_Mask value is zero, the result is equal to the Or_Mask value.
  y The contents of the register can be read with the Read Holding Registers function (function code 03).
  They could, however, be changed subsequently as the controller scans its user logic program.
  
  @param serverAddress slave id
  @param startAddress  reference address
  @param and           the AND mask
  @param or            the OR mask
  @throws ModbusProtocolException if modbus-exception is received
  @throws ModbusNumberException   if response is invalid
  @throws ModbusIOException       if remote slave is unavailable