code: public void appendBits(int value, int numBits) {
      if (numBits < 0 || numBits > 32) {
        throw new IllegalArgumentException("Num bits must be between 0 and 32");
      }
      ensureCapacity(size + numBits);
      for (int numBitsLeft = numBits; numBitsLeft > 0; numBitsLeft--) {
        appendBit(((value >> (numBitsLeft - 1)) & 0x01) == 1);
      }
    }
docs: Appends the least-significant bits, from value, in order from most-significant to
  least-significant. For example, appending 6 bits from 0x000001E will append the bits
  0, 1, 1, 1, 1, 0 in that order.
  
  @param value {@code int} containing bits to append
  @param numBits bits from value to append