int[]s as bit sets.
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static boolean | Returns: true if any bit is set to true in
the indicated rangenon-null; bit set to operate on>= 0; index of the first bit in the range (inclusive)>= 0; index of the last bit in the range (exclusive)Returns whether any bits are set to |
| public static int | Returns: >= 0; the bit count (aka population count) of the setnon-null; bit set to operate onGets the number of bits set to |
| public static void | clear(int[]
non-null; bit set to operate on>= 0, < getMax(set); which bitSets the given bit to |
| public static int | Returns: >= -1; lowest-order bit set at or after idx,
or -1 if there is no appropriate bit index to returnnon-null; bit set to operate on>= 0; minimum index to returnFinds the lowest-order bit set at or after the given index in the given bit set. |
| public static int | Returns: >= -1; lowest-order bit set at or after idx,
or -1 if there is no appropriate bit index to returnthe value in question value, int 0..31 the minimum bit index to return idx)Finds the lowest-order bit set at or after the given index in the
given |
| public static boolean | Returns: the value of the indicated bitnon-null; bit set to operate on>= 0, < getMax(set); which bitGets the value of the bit at the given index. |
| public static int | Returns: >= 0; the maximum index (exclusive) that may be setnon-null; bit set in questionGets the maximum index (exclusive) for the given bit set. |
| public static boolean | Returns: true iff all bits are falsenon-null; bit set to operate onReturns whether or not the given bit set is empty, that is, whether
no bit is set to |
| public static int[] | Returns: non-null; an appropriately-constructed instance>= 0; the maximum bit index (exclusive)Constructs a bit set to contain bits up to the given index (exclusive). |
| public static void | or(int[]
non-null; int array to be ored with other argument. This
argument is modified.non-null; int array to be ored into a. This
argument is not modified.Ors bit array |
| public static void | set(int[]
non-null; bit set to operate on>= 0, < getMax(set); which bitthe new value for the bit value)Sets the given bit to the given value. |
| public static void | set(int[]
non-null; bit set to operate on>= 0, < getMax(set); which bitSets the given bit to |
| public static String |
| Bits | back to summary |
|---|---|
| private Bits() This class is uninstantiable. | |
| anyInRange | back to summary |
|---|---|
| public static boolean anyInRange(int[] bits, int start, int end) Returns whether any bits are set to
| |
| bitCount | back to summary |
|---|---|
| public static int bitCount(int[] bits) Gets the number of bits set to
| |
| clear | back to summary |
|---|---|
| public static void clear(int[] bits, int idx) Sets the given bit to
| |
| findFirst | back to summary |
|---|---|
| public static int findFirst(int[] bits, int idx) Finds the lowest-order bit set at or after the given index in the given bit set.
| |
| findFirst | back to summary |
|---|---|
| public static int findFirst(int value, int idx) Finds the lowest-order bit set at or after the given index in the
given
| |
| get | back to summary |
|---|---|
| public static boolean get(int[] bits, int idx) Gets the value of the bit at the given index.
| |
| getMax | back to summary |
|---|---|
| public static int getMax(int[] bits) Gets the maximum index (exclusive) for the given bit set.
| |
| isEmpty | back to summary |
|---|---|
| public static boolean isEmpty(int[] bits) Returns whether or not the given bit set is empty, that is, whether
no bit is set to
| |
| makeBitSet | back to summary |
|---|---|
| public static int[] makeBitSet(int max) Constructs a bit set to contain bits up to the given index (exclusive).
| |
| or | back to summary |
|---|---|
| public static void or(int[] a, int[] b) Ors bit array
| |
| set | back to summary |
|---|---|
| public static void set(int[] bits, int idx, boolean value) Sets the given bit to the given value.
| |
| set | back to summary |
|---|---|
| public static void set(int[] bits, int idx) Sets the given bit to
| |
| toHuman | back to summary |
|---|---|
| public static String toHuman(int[] bits) | |