code: public void set(int index, boolean value)
      throws ArrayIndexOutOfBoundsException {
          if (index < 0 || index >= length) {
              throw new ArrayIndexOutOfBoundsException(Integer.toString(index));
          }
          int idx = subscript(index);
          int bit = position(index);
  
          if (value) {
              repn[idx] |= bit;
          } else {
              repn[idx] &= ~bit;
          }
      }
docs: Sets the indexed bit in this BitArray.