Java exception invalid int for long integer

后端 未结 2 753
天涯浪人
天涯浪人 2021-01-26 04:09

I\'m currently developing a math application that makes long computations. I\'m getting java.lang.NumberFormatException: Invalid int: \"...\" error (where the ... is replaced by

2条回答
  •  春和景丽
    2021-01-26 04:32

    The maximum value for an int is 231-1, i.e. 2,147,483,647. If you try to parse a larger number than that, the exception will be thrown.

    If you need to handle larger numbers, either use long for a generally larger range (up to 263-1) or BigInteger for an arbitrary size.

提交回复
热议问题