public static void set(int[] bits, int idx, boolean value) {
    int arrayIdx = idx >> 5;
    int bit = 1 << (idx & 0x1f);

    if (value) {
      bits[arrayIdx] |= bit;
    } else {
      bits[arrayIdx] &= ~bit;
    }
  }
Sets the given bit to the given value.

@param bits {@code non-null;} bit set to operate on
@param idx {@code >= 0, < getMax(set);} which bit
@param value the new value for the bit
android/android_framework/dex-maker/src/main/java/com/android/dx/util/Bits.java