-
public class BitsUtility definitions for bitwise operations.
-
-
Field Summary
Fields Modifier and Type Field Description public final static intSIZE_OF_INTpublic final static intSIZE_OF_LONG
-
Method Summary
Modifier and Type Method Description static intintMaskOf(int i)Construct {@code int}mask with single bit set.static longlongMaskOf(int i)Construct {@code long}mask with single bit set.static intintMaskOfRange(int i, int j)Construct {@code int}mask with range of bits set.static longlongMaskOfRange(int i, int j)Construct {@code long}mask with range of bits set.static intsizeOfUnsigned(long v)Calculate size, in bits, of an unsigned value. -
-
Method Detail
-
intMaskOf
static int intMaskOf(int i)
Construct
{@code int}mask with single bit set.- Parameters:
i- position of bit to set
-
longMaskOf
static long longMaskOf(int i)
Construct
{@code long}mask with single bit set.- Parameters:
i- position of bit to set
-
intMaskOfRange
static int intMaskOfRange(int i, int j)
Construct
{@code int}mask with range of bits set.- Parameters:
i- position of first bit to set (inclusive)j- position of last bit to set (inclusive)
-
longMaskOfRange
static long longMaskOfRange(int i, int j)
Construct
{@code long}mask with range of bits set.- Parameters:
i- position of first bit to set (inclusive)j- position of last bit to set (inclusive)
-
sizeOfUnsigned
static int sizeOfUnsigned(long v)
Calculate size, in bits, of an unsigned value.
- Parameters:
v- unsigned value to calculate bit size of
-
-
-
-