public class Bits extends Object implements Comparable<Bits>
| Modifier and Type | Field and Description |
|---|---|
int |
bitLength
The Bit length.
|
static Bits |
NULL
The constant NULL.
|
static Bits |
ONE
The constant ONE.
|
static Bits |
ZERO
The constant ZERO.
|
| Constructor and Description |
|---|
Bits(byte... data)
Instantiates a new Bits.
|
Bits(byte[] data,
int length)
Instantiates a new Bits.
|
Bits(long data)
Instantiates a new Bits.
|
Bits(long value,
int length)
Instantiates a new Bits.
|
Bits(Random random,
int length)
Instantiates a new Bits.
|
| Modifier and Type | Method and Description |
|---|---|
Bits |
bitwiseAnd(Bits right)
Bitwise and bits.
|
Bits |
bitwiseOr(Bits right)
Bitwise or bits.
|
Bits |
bitwiseXor(Bits right)
Bitwise xor bits.
|
int |
compareTo(Bits arg0) |
Bits |
concatenate(Bits right)
Concatenate bits.
|
static int |
dataCompare(Bits left,
Bits right)
Data compare int.
|
static Bits |
divide(long numerator,
long denominator,
long maxBits)
Divide bits.
|
boolean |
equals(Object obj) |
byte[] |
getBytes()
Get bytes byte [ ].
|
int |
hashCode() |
static byte |
highestOneBit(long v)
Highest one bit byte.
|
Bits |
leftShift(int bits)
Left shift bits.
|
Bits |
next()
Returns the next binary string which is of the same length but incremented by one.
|
Bits |
padLeft(int targetLength)
Pad left bits.
|
static byte[] |
padLeftBytes(byte[] src,
int bytes)
Pad left bytes byte [ ].
|
Bits |
padRight(long targetLength)
Pad right bits.
|
Bits |
range(int start)
Range bits.
|
Bits |
range(int start,
int length)
Range bits.
|
static byte[] |
shiftLeft(byte[] src,
int bits)
Shift left byte [ ].
|
static void |
shiftLeft(byte[] src,
int bits,
byte[] dst)
Shift left.
|
static byte[] |
shiftRight(byte[] src,
int bits)
Shift right byte [ ].
|
boolean |
startsWith(Bits key)
Starts apply boolean.
|
CharSequence |
toBase64String()
To base 64 string string.
|
String |
toBitString()
To bit string string.
|
static byte[] |
toBytes(long data)
To bytes byte [ ].
|
CharSequence |
toHexString()
To hex string string.
|
long |
toLong()
To long long.
|
String |
toString() |
static byte[] |
trim(byte[] bytes)
Trim byte [ ].
|
public static Bits ONE
public static Bits ZERO
public static Bits NULL
public final int bitLength
public Bits(byte... data)
data - the datapublic Bits(byte[] data,
int length)
data - the datalength - the lengthpublic Bits(long data)
data - the datapublic Bits(long value,
int length)
value - the valuelength - the lengthpublic Bits(Random random, int length)
random - the randomlength - the lengthpublic static Bits divide(long numerator, long denominator, long maxBits)
numerator - the numeratordenominator - the denominatormaxBits - the max bitspublic static int dataCompare(Bits left, Bits right)
left - the leftright - the rightpublic static byte highestOneBit(long v)
v - the vpublic static byte[] padLeftBytes(byte[] src,
int bytes)
src - the srcbytes - the bytespublic static byte[] shiftLeft(byte[] src,
int bits)
src - the srcbits - the bitspublic static void shiftLeft(byte[] src,
int bits,
byte[] dst)
src - the srcbits - the bitsdst - the dstpublic static byte[] shiftRight(byte[] src,
int bits)
src - the srcbits - the bitspublic static byte[] toBytes(long data)
data - the datapublic static byte[] trim(byte[] bytes)
bytes - the bytespublic Bits bitwiseAnd(Bits right)
right - the rightpublic Bits bitwiseOr(Bits right)
right - the rightpublic Bits bitwiseXor(Bits right)
right - the rightpublic int compareTo(Bits arg0)
compareTo in interface Comparable<Bits>public Bits concatenate(Bits right)
right - the rightpublic byte[] getBytes()
public Bits leftShift(int bits)
bits - the bitspublic Bits next()
public Bits range(int start)
start - the startpublic Bits range(int start, int length)
start - the startlength - the lengthpublic boolean startsWith(Bits key)
key - the keypublic String toBitString()
public CharSequence toHexString()
public CharSequence toBase64String()
public long toLong()
public Bits padRight(long targetLength)
targetLength - the peek bitspublic Bits padLeft(int targetLength)
targetLength - the target lengthCopyright © 2019 SimiaCryptus Software. All rights reserved.