code: public static byte setBit(final byte pData, final int pBitIndex, final boolean pOn) {
  		if (pBitIndex < 0 || pBitIndex > 7) {
  			throw new IllegalArgumentException("parameter 'pBitIndex' must be between 0 and 7. pBitIndex=" + pBitIndex);
  		}
  		byte ret = pData;
  		if (pOn) { // Set bit
  			ret |= 1 << pBitIndex;
  		} else { // Unset bit
  			ret &= ~(1 << pBitIndex);
  		}
  		return ret;
  	}
docs: Method used to set a bit index to 1 or 0.
  
  @param pData
  data to modify
  @param pBitIndex
  index to set
  @param pOn
  set bit at specified index to 1 or 0
  @return the modified byte