Class JavaBigIntegerParser

java.lang.Object
ch.randelshofer.fastdoubleparser.JavaBigIntegerParser

public class JavaBigIntegerParser extends Object
Parses a BigInteger value; the supported syntax is a super-set of the syntax supported by BigInteger(String).

Syntax

Formal specification of the grammar:

BigIntegerLiteral:
[Sign] Digits
[Sign] 0x [HexDigits]
[Sign] 0X [HexDigits]
Digits:
Digit {Digit}
HexDigits:
HexDigit {HexDigit}
Digit:
(one of)
0 1 2 3 4 5 6 7 8 9
HexDigit:
(one of)
0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F

Character lengths accepted by BigInteger(String):

  • Significand: 1 to 1,292,782,621 decimal digits.

    The resulting value must fit into 2^31 - 1 bits. The decimal representation of the value 2^31 - 1 has 646,456,993 digits. Therefore an input String can only contain up to that many significant digits - the remaining digits must be leading zeroes.