code: public void set(int index, int value) {
          if (d_bitsPerElem == 0)
              return;
  
          int startIdx = (index * d_bitsPerElem) / INT_SIZE;
          int startBit = (index * d_bitsPerElem) % INT_SIZE;
  
          // Clear data
          d_data[startIdx] &= ~(MASK[d_bitsPerElem] << startBit);
  
          // And set.
          d_data[startIdx] |= value << startBit;
  
          // If the integer didn't have enough bits available, write the rest in the next integer.
          if ((startBit + d_bitsPerElem) > INT_SIZE) {
              int done = INT_SIZE - startBit;
              d_data[startIdx + 1] &= ~MASK[d_bitsPerElem - done];
              d_data[startIdx + 1] |= value >>> done;
          }
  
      }
docs: Set the integer at the given index. <b>Warning:</b> if you attempt to store an integer that
  is wider than the width given to the constructor {@link #CompactIntArray(int, int)}, the integer
  is truncated.
  
  @param index The index.
  @param value The value to store.