BigInteger returns an int for bitLength()

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P3
    • None
    • Affects Version/s: 6u39
    • Component/s: core-libs
    • None

      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.

            Assignee:
            Joe Darcy
            Reporter:
            Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: