|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectru.sstu.math.util.BitsUtil
public final class BitsUtil
BitsUtil class contains of utility methods for working with
bits in integer numbers.
| Method Summary | |
|---|---|
static int |
clearLeadingBits(int number,
int base)
Clears leading bits. |
static long |
clearLeadingBits(long number,
int base)
Clears leading bits. |
static int |
getMostSignificantBit(int number)
Provides most significant bit for given number. |
static long |
getMostSignificantBit(long number)
Provides most significant bit for given number. |
static boolean |
isPowerOf2(int number)
Checks if number is power of 2. |
static boolean |
isPowerOf2(long number)
|
static boolean |
testBit(int number,
int bit)
Test if given bit is set. |
static boolean |
testBit(long number,
int bit)
Test if given bit is set. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static boolean isPowerOf2(int number)
number - integer number to be tested
public static int getMostSignificantBit(int number)
number - integer number
public static boolean testBit(int number,
int bit)
number - integer number to be testedbit - index of bit to be tested beginning from 0
public static int clearLeadingBits(int number,
int base)
base bits remains unchanged.
number - initial numberbase - number of bits that won't be changed
public static boolean isPowerOf2(long number)
number - integer number to be tested
public static long getMostSignificantBit(long number)
number - integer number
public static boolean testBit(long number,
int bit)
number - integer number to be testedbit - index of bit to be tested beginning from 0
public static long clearLeadingBits(long number,
int base)
base bits remains unchanged.
number - initial numberbase - number of bits that won't be changed
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||