code: protected void setNextValue(final long pValue, final int pLength, final int pMaxSize) {
  		long value = pValue;
  		// Set to max value if pValue cannot be stored on pLength bits.
  		long bitMax = (long) Math.pow(2, Math.min(pLength, pMaxSize));
  		if (pValue > bitMax) {
  			value = bitMax - 1;
  		}
  		// size to wrote
  		int writeSize = pLength;
  		while (writeSize > 0) {
  			// modulo
  			int mod = currentBitIndex % BYTE_SIZE;
  			byte ret = 0;
  			if (mod == 0 && writeSize <= BYTE_SIZE || pLength < BYTE_SIZE - mod) {
  				// shift left value
  				ret = (byte) (value << BYTE_SIZE - (writeSize + mod));
  			} else {
  				// shift right
  				long length = Long.toBinaryString(value).length();
  				ret = (byte) (value >> writeSize - length - (BYTE_SIZE - length - mod));
  			}
  			byteTab[currentBitIndex / BYTE_SIZE] |= ret;
  			long val = Math.min(writeSize, BYTE_SIZE - mod);
  			writeSize -= val;
  			currentBitIndex += val;
  		}
  	}
docs: Add Value to the current position with the specified size
  
  @param pValue
  value to add
  @param pLength
  length of the value
  @param pMaxSize
  max size in bits