FULL PRODUCT VERSION :
1.6.0_39 (although the bug still exists in version 7)
ADDITIONAL OS VERSION INFORMATION :
Any standard desktop system
A DESCRIPTION OF THE PROBLEM :
BigInteger.bitLength() returns an int, despite the fact that a BigInteger can hold >= 2^31 bits.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
BigInteger bi = BigInteger.TEN.pow(600000000).pow(2);
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
the returned value will be negative
ACTUAL -
I haven't tried it
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
See above
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Document the method as SILENTLY returning an invalid value if the BigInteger contains >= 2^31 bits.
1.6.0_39 (although the bug still exists in version 7)
ADDITIONAL OS VERSION INFORMATION :
Any standard desktop system
A DESCRIPTION OF THE PROBLEM :
BigInteger.bitLength() returns an int, despite the fact that a BigInteger can hold >= 2^31 bits.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
BigInteger bi = BigInteger.TEN.pow(600000000).pow(2);
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
the returned value will be negative
ACTUAL -
I haven't tried it
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
See above
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Document the method as SILENTLY returning an invalid value if the BigInteger contains >= 2^31 bits.
- duplicates
-
JDK-6910473 java.math.BigInteger.bitLength() may return negative "int" on large numbers
- Closed