Java Reference
In-Depth Information
BigInteger
BigDecimal
stores a signed decimal number as an unscaled value with a 32-bit in-
teger scale. The unscaled value is stored in an instance of the
BigInteger
class.
BigInteger
isanimmutableclassthatrepresentsasignedintegerofarbitrarypre-
cision.Itstoresitsvaluein
two's complement format
(allbitsareflipped—1sto0sand
0sto1s—and1isaddedtotheresulttobecompatiblewiththetwo'scomplementformat
used by Java's byte integer, short integer, integer, and long integer types).
Note
Check out Wikipedia's “Two's complement” entry (
ht-
tp://en.wikipedia.org/wiki/Two's_complement
)
to learn more about
two's complement.
BigInteger
declares three convenience constants:
ONE
,
TEN
, and
ZERO
. Each
constant is the
BigInteger
equivalent of 1, 10, and 0.
BigInteger
also declares a variety ofuseful constructors and methods. Afew of
these constructors and methods are described in
Table 4-10
.