Why does the BigInteger class have a few pre-defined static constants,
as in ZERO, ONE, and TEN?
Seems very arbitrary. What is the reasoning behind this in the first
place?
FGB
Stefan Schulz - 23 Feb 2006 06:36 GMT
BigIntegers are immutable, therefore it makes sense to share some
common instances.
Traditionally, these three numbers crop up rather frequently, so
offering "shorthand" instances for them makes sense. Even more if you
consider the "static import" feature of java 1.5 - setBase(TEN) is much
clearer then setBase(new BigInteger(10))