public class Bit extends Number
Modifier and Type | Field and Description |
---|---|
private boolean |
bit
Internal representation of the bit value.
|
static Pattern |
BIT_PATTERN
Pattern defining valid bit values.
|
private static long |
serialVersionUID
Generated serial version UID.
|
Constructor and Description |
---|
Bit(boolean bit)
Provides a new bit according to the specified boolean value.
|
Bit(int bit)
Provides a new bit according to the specified integer value.
|
Modifier and Type | Method and Description |
---|---|
boolean |
bitValue()
Returns the bit value as a boolean.
|
double |
doubleValue()
Provides a double value for the integer representation of this Bit as given
by
intValue() . |
float |
floatValue()
Provides a float value for the integer representation of this Bit as given
by
intValue() . |
int |
intValue()
Provides an integer representation of the bit.
|
long |
longValue()
Provides a long value for the integer representation of this Bit as given
by
intValue() . |
String |
toString()
Provides the String representation of the integer representation of this
Bit as given by
intValue() . |
static Bit |
valueOf(String bit)
Method to construct a Bit for a given String expression.
|
byteValue, shortValue
private static final long serialVersionUID
public static final Pattern BIT_PATTERN
private boolean bit
public Bit(boolean bit)
bit
- the boolean value of this bitpublic Bit(int bit) throws IllegalArgumentException
bit
- 1 for true and 0 for falseIllegalArgumentException
- if the specified value is neither 0 nor 1.public static Bit valueOf(String bit) throws NumberFormatException
bit
- a String expression defining a BitNumberFormatException
- if the given String expression does not fit
to the Pattern BIT_PATTERN
public int intValue()
public long longValue()
intValue()
.public float floatValue()
intValue()
.floatValue
in class Number
public double doubleValue()
intValue()
.doubleValue
in class Number
public boolean bitValue()
public String toString()
intValue()
.toString
in class Object
Object.toString()