Package com.google.common.primitives
Class UnsignedLong
- java.lang.Object
-
- java.lang.Number
-
- com.google.common.primitives.UnsignedLong
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<UnsignedLong>
@GwtCompatible(serializable=true) @Deprecated(since="2022-12-01") public final class UnsignedLong extends java.lang.Number implements java.lang.Comparable<UnsignedLong>, java.io.Serializable
Deprecated.The Google Guava Core Libraries are deprecated and will not be part of the AEM SDK after April 2023A wrapper class for unsignedlong
values, supporting arithmetic operations.In some cases, when speed is more important than code readability, it may be faster simply to treat primitive
long
values as unsigned, using the methods fromUnsignedLongs
.See the Guava User Guide article on unsigned primitive utilities.
- Since:
- 11.0
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static UnsignedLong
MAX_VALUE
Deprecated.static UnsignedLong
ONE
Deprecated.static UnsignedLong
ZERO
Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.math.BigInteger
bigIntegerValue()
Deprecated.Returns the value of thisUnsignedLong
as aBigInteger
.int
compareTo(UnsignedLong o)
Deprecated.UnsignedLong
dividedBy(UnsignedLong val)
Deprecated.Returns the result of dividing this byval
.double
doubleValue()
Deprecated.Returns the value of thisUnsignedLong
as adouble
, analogous to a widening primitive conversion fromlong
todouble
, and correctly rounded.boolean
equals(java.lang.Object obj)
Deprecated.float
floatValue()
Deprecated.Returns the value of thisUnsignedLong
as afloat
, analogous to a widening primitive conversion fromlong
tofloat
, and correctly rounded.static UnsignedLong
fromLongBits(long bits)
Deprecated.Returns anUnsignedLong
corresponding to a given bit representation.int
hashCode()
Deprecated.int
intValue()
Deprecated.Returns the value of thisUnsignedLong
as anint
.long
longValue()
Deprecated.Returns the value of thisUnsignedLong
as along
.UnsignedLong
minus(UnsignedLong val)
Deprecated.Returns the result of subtracting this andval
.UnsignedLong
mod(UnsignedLong val)
Deprecated.Returns this moduloval
.UnsignedLong
plus(UnsignedLong val)
Deprecated.Returns the result of adding this andval
.UnsignedLong
times(UnsignedLong val)
Deprecated.Returns the result of multiplying this andval
.java.lang.String
toString()
Deprecated.Returns a string representation of theUnsignedLong
value, in base 10.java.lang.String
toString(int radix)
Deprecated.Returns a string representation of theUnsignedLong
value, in baseradix
.static UnsignedLong
valueOf(long value)
Deprecated.Returns anUnsignedLong
representing the same value as the specifiedlong
.static UnsignedLong
valueOf(java.lang.String string)
Deprecated.Returns anUnsignedLong
holding the value of the specifiedString
, parsed as an unsignedlong
value.static UnsignedLong
valueOf(java.lang.String string, int radix)
Deprecated.Returns anUnsignedLong
holding the value of the specifiedString
, parsed as an unsignedlong
value in the specified radix.static UnsignedLong
valueOf(java.math.BigInteger value)
Deprecated.Returns aUnsignedLong
representing the same value as the specifiedBigInteger
.
-
-
-
Field Detail
-
ZERO
public static final UnsignedLong ZERO
Deprecated.
-
ONE
public static final UnsignedLong ONE
Deprecated.
-
MAX_VALUE
public static final UnsignedLong MAX_VALUE
Deprecated.
-
-
Method Detail
-
fromLongBits
public static UnsignedLong fromLongBits(long bits)
Deprecated.Returns anUnsignedLong
corresponding to a given bit representation. The argument is interpreted as an unsigned 64-bit value. Specifically, the sign bit ofbits
is interpreted as a normal bit, and all other bits are treated as usual.If the argument is nonnegative, the returned result will be equal to
bits
, otherwise, the result will be equal to2^64 + bits
.To represent decimal constants less than
2^63
, considervalueOf(long)
instead.- Since:
- 14.0
-
valueOf
public static UnsignedLong valueOf(long value)
Deprecated.Returns anUnsignedLong
representing the same value as the specifiedlong
.- Throws:
java.lang.IllegalArgumentException
- ifvalue
is negative- Since:
- 14.0
-
valueOf
public static UnsignedLong valueOf(java.math.BigInteger value)
Deprecated.Returns aUnsignedLong
representing the same value as the specifiedBigInteger
. This is the inverse operation ofbigIntegerValue()
.- Throws:
java.lang.IllegalArgumentException
- ifvalue
is negative orvalue >= 2^64
-
valueOf
public static UnsignedLong valueOf(java.lang.String string)
Deprecated.Returns anUnsignedLong
holding the value of the specifiedString
, parsed as an unsignedlong
value.- Throws:
java.lang.NumberFormatException
- if the string does not contain a parsable unsignedlong
value
-
valueOf
public static UnsignedLong valueOf(java.lang.String string, int radix)
Deprecated.Returns anUnsignedLong
holding the value of the specifiedString
, parsed as an unsignedlong
value in the specified radix.- Throws:
java.lang.NumberFormatException
- if the string does not contain a parsable unsignedlong
value, orradix
is not betweenCharacter.MIN_RADIX
andCharacter.MAX_RADIX
-
plus
public UnsignedLong plus(UnsignedLong val)
Deprecated.Returns the result of adding this andval
. If the result would have more than 64 bits, returns the low 64 bits of the result.- Since:
- 14.0
-
minus
public UnsignedLong minus(UnsignedLong val)
Deprecated.Returns the result of subtracting this andval
. If the result would have more than 64 bits, returns the low 64 bits of the result.- Since:
- 14.0
-
times
@CheckReturnValue public UnsignedLong times(UnsignedLong val)
Deprecated.Returns the result of multiplying this andval
. If the result would have more than 64 bits, returns the low 64 bits of the result.- Since:
- 14.0
-
dividedBy
@CheckReturnValue public UnsignedLong dividedBy(UnsignedLong val)
Deprecated.Returns the result of dividing this byval
.- Since:
- 14.0
-
mod
@CheckReturnValue public UnsignedLong mod(UnsignedLong val)
Deprecated.Returns this moduloval
.- Since:
- 14.0
-
intValue
public int intValue()
Deprecated.Returns the value of thisUnsignedLong
as anint
.- Specified by:
intValue
in classjava.lang.Number
-
longValue
public long longValue()
Deprecated.Returns the value of thisUnsignedLong
as along
. This is an inverse operation tofromLongBits(long)
.Note that if this
UnsignedLong
holds a value>= 2^63
, the returned value will be equal tothis - 2^64
.- Specified by:
longValue
in classjava.lang.Number
-
floatValue
public float floatValue()
Deprecated.Returns the value of thisUnsignedLong
as afloat
, analogous to a widening primitive conversion fromlong
tofloat
, and correctly rounded.- Specified by:
floatValue
in classjava.lang.Number
-
doubleValue
public double doubleValue()
Deprecated.Returns the value of thisUnsignedLong
as adouble
, analogous to a widening primitive conversion fromlong
todouble
, and correctly rounded.- Specified by:
doubleValue
in classjava.lang.Number
-
bigIntegerValue
public java.math.BigInteger bigIntegerValue()
Deprecated.Returns the value of thisUnsignedLong
as aBigInteger
.
-
compareTo
public int compareTo(UnsignedLong o)
Deprecated.- Specified by:
compareTo
in interfacejava.lang.Comparable<UnsignedLong>
-
hashCode
public int hashCode()
Deprecated.- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(@Nullable java.lang.Object obj)
Deprecated.- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
Deprecated.Returns a string representation of theUnsignedLong
value, in base 10.- Overrides:
toString
in classjava.lang.Object
-
toString
public java.lang.String toString(int radix)
Deprecated.Returns a string representation of theUnsignedLong
value, in baseradix
. Ifradix < Character.MIN_RADIX
orradix > Character.MAX_RADIX
, the radix10
is used.
-
-