|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.android.dx.util.Bits
public final class Bits
Utilities for treating int[]s as bit sets.
| Method Summary | |
|---|---|
static boolean |
anyInRange(int[] bits,
int start,
int end)
Returns whether any bits are set to true in the
specified range. |
static int |
bitCount(int[] bits)
Gets the number of bits set to true in the given bit set. |
static void |
clear(int[] bits,
int idx)
Sets the given bit to false. |
static int |
findFirst(int[] bits,
int idx)
Finds the lowest-order bit set at or after the given index in the given bit set. |
static int |
findFirst(int value,
int idx)
Finds the lowest-order bit set at or after the given index in the given int. |
static boolean |
get(int[] bits,
int idx)
Gets the value of the bit at the given index. |
static int |
getMax(int[] bits)
Gets the maximum index (exclusive) for the given bit set. |
static boolean |
isEmpty(int[] bits)
Returns whether or not the given bit set is empty, that is, whether no bit is set to true. |
static int[] |
makeBitSet(int max)
Constructs a bit set to contain bits up to the given index (exclusive). |
static void |
or(int[] a,
int[] b)
Ors bit array b into bit array a. |
static void |
set(int[] bits,
int idx)
Sets the given bit to true. |
static void |
set(int[] bits,
int idx,
boolean value)
Sets the given bit to the given value. |
static String |
toHuman(int[] bits)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static int[] makeBitSet(int max)
max - >= 0; the maximum bit index (exclusive)
non-null; an appropriately-constructed instancepublic static int getMax(int[] bits)
bits - non-null; bit set in question
>= 0; the maximum index (exclusive) that may be set
public static boolean get(int[] bits,
int idx)
bits - non-null; bit set to operate onidx - >= 0, < getMax(set); which bit
public static void set(int[] bits,
int idx,
boolean value)
bits - non-null; bit set to operate onidx - >= 0, < getMax(set); which bitvalue - the new value for the bit
public static void set(int[] bits,
int idx)
true.
bits - non-null; bit set to operate onidx - >= 0, < getMax(set); which bit
public static void clear(int[] bits,
int idx)
false.
bits - non-null; bit set to operate onidx - >= 0, < getMax(set); which bitpublic static boolean isEmpty(int[] bits)
true.
bits - non-null; bit set to operate on
true iff all bits are falsepublic static int bitCount(int[] bits)
true in the given bit set.
bits - non-null; bit set to operate on
>= 0; the bit count (aka population count) of the set
public static boolean anyInRange(int[] bits,
int start,
int end)
true in the
specified range.
bits - non-null; bit set to operate onstart - >= 0; index of the first bit in the range (inclusive)end - >= 0; index of the last bit in the range (exclusive)
true if any bit is set to true in
the indicated range
public static int findFirst(int[] bits,
int idx)
bits - non-null; bit set to operate onidx - >= 0; minimum index to return
>= -1; lowest-order bit set at or after idx,
or -1 if there is no appropriate bit index to return
public static int findFirst(int value,
int idx)
int.
value - the value in questionidx - 0..31 the minimum bit index to return
>= -1; lowest-order bit set at or after idx,
or -1 if there is no appropriate bit index to return
public static void or(int[] a,
int[] b)
b into bit array a.
a.length must be greater than or equal to
b.length.
a - non-null; int array to be ored with other argument. This
argument is modified.b - non-null; int array to be ored into a. This
argument is not modified.public static String toHuman(int[] bits)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||