public final class UnsignedInteger extends Number implements Comparable<Number>, BitField
| Modifier and Type | Field and Description |
|---|---|
static UnsignedInteger[] |
EMPTY_ARRAY |
static long |
L_MAX_VALUE |
static long |
L_MIN_VALUE |
static UnsignedInteger |
MAX_VALUE |
static UnsignedInteger |
MIN_VALUE |
static UnsignedInteger |
ONE |
static UnsignedInteger |
ZERO |
| Constructor and Description |
|---|
UnsignedInteger()
Deprecated.
use
ZERO instead. |
UnsignedInteger(int value)
Deprecated.
use
valueOf(long) instead. |
UnsignedInteger(long value)
Deprecated.
valueOf(long) instead. |
UnsignedInteger(String value)
Deprecated.
use
valueOf(String) instead. |
UnsignedInteger(UnsignedByte value)
Deprecated.
use
valueOf(UnsignedByte) instead. |
UnsignedInteger(UnsignedInteger value)
Deprecated.
should not be used. Use the given value directly as
UnsignedInteger. |
| Modifier and Type | Method and Description |
|---|---|
UnsignedInteger |
add(int increment)
Add a value.
|
UnsignedInteger |
add(long increment)
Add a value.
|
UnsignedInteger |
add(UnsignedInteger increment)
Add a value.
|
UnsignedInteger |
and(int value)
and.
|
UnsignedInteger |
and(long value)
and.
|
UnsignedInteger |
and(UnsignedInteger value)
and.
|
static UnsignedInteger[] |
arrayOf()
Returns an empty UnsignedInteger array.
|
static UnsignedInteger[] |
arrayOf(long... elements)
Returns an UnsignedInteger array with the given elements.
|
static UnsignedInteger[] |
arrayOf(String... elements)
Returns an UnsignedInteger array with the given elements.
|
byte |
byteValue() |
static UnsignedInteger |
clamp(UnsignedInteger value,
UnsignedInteger min,
UnsignedInteger max)
Clamps the given value to fit between min and max.
|
int |
compareTo(Number other) |
UnsignedInteger |
dec()
Decrease the value by one.
|
UnsignedInteger |
decOrWrap()
|
UnsignedInteger |
decOrWrapTo(UnsignedInteger target)
If equals
MIN_VALUE, returns the given target, otherwise return value - 1. |
double |
doubleValue() |
boolean |
equals(Object obj) |
float |
floatValue() |
static UnsignedInteger |
getFromBits(int value)
getFromBits.
|
long |
getValue()
Getter for the field
value. |
int |
hashCode() |
UnsignedInteger |
inc()
Increase the value by one.
|
UnsignedInteger |
incOrWrap()
|
UnsignedInteger |
incOrWrapTo(UnsignedInteger target)
If equals
MAX_VALUE, returns the given target, otherwise return value + 1. |
int |
intValue() |
boolean |
isBitSet(int position)
Is bit set in position.
|
long |
longValue() |
static UnsignedInteger |
max(UnsignedInteger v0,
UnsignedInteger v1)
max.
|
static UnsignedInteger |
min(UnsignedInteger v0,
UnsignedInteger v1)
min.
|
UnsignedInteger |
or(int value)
or.
|
UnsignedInteger |
or(long value)
or.
|
UnsignedInteger |
or(UnsignedInteger value)
or.
|
static UnsignedInteger |
parseUnsignedInteger(String string)
Parse an UnsignedInteger value from a string.
|
static UnsignedInteger |
parseUnsignedInteger(String string,
int radix)
Parses the string argument as an unsigned integer similar to
Long.parseLong(String, int). |
static UnsignedInteger |
replaceIfNullOrEqual(UnsignedInteger value,
UnsignedInteger checkValue,
UnsignedInteger defaultValue)
Returns the given defaultValue, if the given value is either null or equals to the given
checkValue.
|
static UnsignedInteger |
replaceIfNullOrZero(UnsignedInteger value,
UnsignedInteger defaultValue)
Convenience method for
replaceIfNullOrEqual(UnsignedInteger, UnsignedInteger, UnsignedInteger), that uses
ZERO for the checkValue. |
UnsignedInteger |
subtract(int decrement)
Subtract a value from this value.
|
UnsignedInteger |
subtract(long decrement)
Subtract a value from this value.
|
UnsignedInteger |
subtract(UnsignedInteger decrement)
Subtract a value from this value.
|
String |
toHex()
Convert the value to a hexadecimal string.
|
int |
toIntBits()
toIntBits.
|
String |
toString() |
static UnsignedInteger |
valueOf(long value)
valueOf.
|
static UnsignedInteger |
valueOf(String string)
Parses
UnsignedInteger from String. |
static UnsignedInteger |
valueOf(String string,
int radix)
Parses
UnsignedInteger from String. |
static UnsignedInteger |
valueOf(UnsignedByte value)
Returns
UnsignedInteger equivalent of the same value as the given UnsignedByte. |
shortValuepublic static final long L_MAX_VALUE
public static final long L_MIN_VALUE
public static final UnsignedInteger MAX_VALUE
public static final UnsignedInteger MIN_VALUE
public static final UnsignedInteger ZERO
public static final UnsignedInteger ONE
public static final UnsignedInteger[] EMPTY_ARRAY
@Deprecated public UnsignedInteger()
ZERO instead.Constructor for UnsignedInteger.
@Deprecated public UnsignedInteger(int value) throws IllegalArgumentException
valueOf(long) instead.Constructor for UnsignedInteger.
value - a int.IllegalArgumentException - if any.@Deprecated public UnsignedInteger(long value) throws IllegalArgumentException
valueOf(long) instead.Constructor for UnsignedInteger.
value - a long.IllegalArgumentException - if any.@Deprecated public UnsignedInteger(String value) throws IllegalArgumentException
valueOf(String) instead.Constructor for UnsignedInteger.
value - a String object.IllegalArgumentException - if any.@Deprecated public UnsignedInteger(UnsignedByte value)
valueOf(UnsignedByte) instead.Constructor for UnsignedInteger.
value - a UnsignedByte object.@Deprecated public UnsignedInteger(UnsignedInteger value)
UnsignedInteger.Constructor for UnsignedInteger.
value - a UnsignedInteger object.public static UnsignedInteger[] arrayOf()
public static UnsignedInteger[] arrayOf(long... elements)
valueOf(long). If given null array for elements returns null.public static UnsignedInteger[] arrayOf(String... elements)
valueOf(String). If given null array for elements returns null.public static UnsignedInteger clamp(UnsignedInteger value, UnsignedInteger min, UnsignedInteger max)
ZERO.public static UnsignedInteger getFromBits(int value)
getFromBits.
value - a int.UnsignedInteger object.public static UnsignedInteger max(UnsignedInteger v0, UnsignedInteger v1)
max.
v0 - a UnsignedInteger object.v1 - a UnsignedInteger object.UnsignedInteger object.public static UnsignedInteger min(UnsignedInteger v0, UnsignedInteger v1)
min.
v0 - a UnsignedInteger object.v1 - a UnsignedInteger object.UnsignedInteger object.public static UnsignedInteger parseUnsignedInteger(String string) throws NumberFormatException, IllegalArgumentException
string - the string to parse, assumed to contain a positive Long valueNumberFormatException - if the string cannot be parsed into a Long valueIllegalArgumentException - if the parsed value does not fit in the range of
UnsignedIntegerpublic static UnsignedInteger parseUnsignedInteger(String string, int radix) throws NumberFormatException, IllegalArgumentException
Long.parseLong(String, int).string - the string to parse, assumed to contain a positive Long valueradix - the radix to be used while parsing s.NumberFormatException - if the string cannot be parsed into a Long value using
the radixIllegalArgumentException - if the parsed value does not fit in the range of
UnsignedIntegerpublic static UnsignedInteger replaceIfNullOrEqual(UnsignedInteger value, UnsignedInteger checkValue, UnsignedInteger defaultValue)
public static UnsignedInteger replaceIfNullOrZero(UnsignedInteger value, UnsignedInteger defaultValue)
replaceIfNullOrEqual(UnsignedInteger, UnsignedInteger, UnsignedInteger), that uses
ZERO for the checkValue. Returns the given defaultValue, if the given value is either
null or .public static UnsignedInteger valueOf(long value)
valueOf.
value - a long.UnsignedInteger object.public static UnsignedInteger valueOf(String string)
UnsignedInteger from String. Behaves same as
parseUnsignedInteger(String).public static UnsignedInteger valueOf(String string, int radix)
UnsignedInteger from String. Behaves same as
parseUnsignedInteger(String, int).public static UnsignedInteger valueOf(UnsignedByte value)
UnsignedInteger equivalent of the same value as the given UnsignedByte.public UnsignedInteger add(int increment)
increment - the value to add to the current valuepublic UnsignedInteger add(long increment)
increment - the value to add to the current valuepublic UnsignedInteger add(UnsignedInteger increment)
increment - the value to add to the current valuepublic UnsignedInteger and(int value)
and.
value - a int.UnsignedInteger object.public UnsignedInteger and(long value)
and.
value - a long.UnsignedInteger object.public UnsignedInteger and(UnsignedInteger value)
and.
value - a UnsignedInteger object.UnsignedInteger object.public int compareTo(Number other)
compareTo in interface Comparable<Number>public UnsignedInteger dec()
IllegalArgumentException - if the value was 0 before the callpublic UnsignedInteger decOrWrap()
public UnsignedInteger decOrWrapTo(UnsignedInteger target)
MIN_VALUE, returns the given target, otherwise return value - 1.public double doubleValue()
doubleValue in class Numberpublic float floatValue()
floatValue in class Numberpublic long getValue()
Getter for the field value.
public UnsignedInteger inc()
public UnsignedInteger incOrWrap()
public UnsignedInteger incOrWrapTo(UnsignedInteger target)
MAX_VALUE, returns the given target, otherwise return value + 1.public boolean isBitSet(int position)
BitFieldpublic UnsignedInteger or(int value)
or.
value - a int.UnsignedInteger object.public UnsignedInteger or(long value)
or.
value - a long.UnsignedInteger object.public UnsignedInteger or(UnsignedInteger value)
or.
value - a UnsignedInteger object.UnsignedInteger object.public UnsignedInteger subtract(int decrement)
decrement - the value to subtract from the current valueIllegalArgumentException - if the decrement is bigger than the current valuepublic UnsignedInteger subtract(long decrement)
decrement - the value to subtract from the current valueIllegalArgumentException - if the decrement is bigger than the current valuepublic UnsignedInteger subtract(UnsignedInteger decrement)
decrement - the value to subtract from the current valueIllegalArgumentException - if the decrement is bigger than the current valuepublic String toHex()
Uses CryptoUtil.toHex(int) to do the conversion.
public int toIntBits()
toIntBits.
Copyright © 2026. All rights reserved.