Class BitUtil
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic byteclearBit(byte i, int num) static charclearBit(char i, int num) static intclearBit(int i, int num) static longclearBit(long i, int num) static shortclearBit(short i, int num) static booleanisBitSet(byte i, int num) returns true is specified bit in the specified byte is set.static booleanisBitSet(char i, int num) static booleanisBitSet(int i, int num) static booleanisBitSet(long i, int num) static booleanisBitSet(short i, int num) static voidstatic bytesetBit(byte i, int num) static charsetBit(char i, int num) static intsetBit(int i, int num) static longsetBit(long i, long num) static shortsetBit(short i, int num) static StringtoBinaryString(byte i) static StringtoBinaryString(byte i, String format) returns a 8 char binary digit string.static StringtoBinaryString(char i) returns a 16 char binary digit stringstatic StringtoBinaryString(char i, String format) returns a 16 char binary digit string.static StringtoBinaryString(int i) returns a 32 char binary digit string (Integer.toBinaryString is not padded, can be less than 32 chars)static StringtoBinaryString(int i, String format) returns a 32char binary digit string (Long.toBinaryString is not padded, can be less than 32 chars).static StringtoBinaryString(long i) returns a 64 char binary digit string (Long.toBinaryString is not padded, can be less than 64 chars))static StringtoBinaryString(long i, String format) returns a 64 char binary digit string (Long.toBinaryString is not padded, can be less than 64 chars).static StringtoBinaryString(short i) returns a 16 char binary digit stringstatic StringtoBinaryString(short i, String format) returns a 16 char binary digit string.
- 
Constructor Details- 
BitUtilpublic BitUtil()
 
- 
- 
Method Details- 
isBitSetreturns true is specified bit in the specified byte is set. The num parameter is the bit position (0-based index). Set means the bit has value 1.
- 
isBitSet
- 
isBitSet
- 
isBitSet
- 
isBitSet
- 
setBit
- 
setBit
- 
setBit
- 
setBit
- 
setBit
- 
clearBit
- 
clearBit
- 
clearBit
- 
clearBit
- 
clearBit
- 
toBinaryString
- 
toBinaryStringreturns a 16 char binary digit string
- 
toBinaryStringreturns a 16 char binary digit string
- 
toBinaryStringreturns a 32 char binary digit string (Integer.toBinaryString is not padded, can be less than 32 chars)
- 
toBinaryStringreturns a 64 char binary digit string (Long.toBinaryString is not padded, can be less than 64 chars))
- 
toBinaryStringreturns a 8 char binary digit string.The format string has a number and separator, like "4 " which will print chunks of size with the specified . The number must be between [1-9] and separator must be a single character, like: | or space. Errors in the format string are ignored and default values are used instead (4 and space). 
- 
toBinaryStringreturns a 16 char binary digit string.The format string has a number and separator, like "4 " which will print chunks of size with the specified . The number must be between [1-9] and separator must be a single character, like: | or space. Errors in the format string are ignored and default values are used instead (4 and space). 
- 
toBinaryStringreturns a 16 char binary digit string.The format string has a number and separator, like "4 " which will print chunks of size num with the specified separator. 
- 
toBinaryStringreturns a 32char binary digit string (Long.toBinaryString is not padded, can be less than 32 chars).The format string has a number and separator, like "4 " which will print chunks of size with the specified . The number must be between [1-9] and separator must be a single character, like: | or space. Errors in the format string are ignored and default values are used instead (4 and space). 
- 
toBinaryStringreturns a 64 char binary digit string (Long.toBinaryString is not padded, can be less than 64 chars).The format string has a number and separator, like "4 " which will print chunks of size with the specified . The number must be between [1-9] and separator must be a single character, like: | or space. Errors in the format string are ignored and default values are used instead (4 and space). 
- 
main
 
-