Modifier and Type | Method and Description |
---|---|
static int |
access(int bits,
int start,
int finish)
Get the bits from start (inclusive) to finish (exclusive),
leaving them aligned in the int.
|
static int |
clear(int bits,
int start,
int finish)
Clear the bits specified.
|
static boolean |
isSet(int bits,
int bitIndex)
Test whether a bit is set
|
static int |
mask(int start,
int finish)
Create a mask that has ones between bit positions start (inc) and finish (exc),
and zeros elsewhere.
|
static int |
maskZero(int start,
int finish)
Create a mask that has zeros between bit positions start (inc) and finish (exc),
and ones elsewhere
|
static int |
pack(int bits,
int value,
int start,
int finish)
Place the value into the bit pattern between start and finish
and returns the new int.
|
static int |
set(int bits,
int bitIndex)
Set the bits specificied.
|
static int |
set(int bits,
int start,
int finish)
Set the bits from start (inc) to finish (exc) to one
|
static boolean |
test(int bits,
boolean isSet,
int bitIndex)
Test whether a bit is the same as isSet
|
static boolean |
test(int bits,
int value,
int start,
int finish)
Test whether a range has a specific value or not
|
static int |
unpack(int bits,
int start,
int finish)
Extract the value packed into bits start (inclusive) and finish (exclusive).
|
static int |
unpack(String str,
int startChar,
int finishChar)
Get bits from a hex string.
|
public static final int unpack(int bits, int start, int finish)
bits
- start
- finish
- public static final int pack(int bits, int value, int start, int finish)
bits
- value
- start
- finish
- public static final int unpack(String str, int startChar, int finishChar)
str
- startChar
- Index of first character (counted from the left, string style).finishChar
- Index after the last character (counted from the left, string style).public static final int set(int bits, int bitIndex)
bits
- PatternbitIndex
- public static final int set(int bits, int start, int finish)
bits
- Patternstart
- start (inclusive)finish
- finish (exclusive)public static final boolean test(int bits, boolean isSet, int bitIndex)
bits
- PatternisSet
- Test whether is set or not.bitIndex
- Bit indexpublic static final boolean isSet(int bits, int bitIndex)
bits
- PatternbitIndex
- Bit indexpublic static final boolean test(int bits, int value, int start, int finish)
bits
- Patternvalue
- Value to test forstart
- start (inclusive)finish
- finish (exclusive)public static final int access(int bits, int start, int finish)
bits
- start
- finish
- unpack(int, int, int)
public static final int clear(int bits, int start, int finish)
bits
- start
- finish
- public static final int mask(int start, int finish)
start
- finish
- public static final int maskZero(int start, int finish)
start
- finish
- Licenced under the Apache License, Version 2.0