Input of big number to avoid NumberFormatException

前端 未结 1 878
我寻月下人不归
我寻月下人不归 2021-01-29 11:42

I have to control input from 1 to 9999999999 (that represents the registration number of school) The primitive type long can only hold up to about 2.000.000.000, how can i store

相关标签:
1条回答
  • 2021-01-29 12:23

    According to this, the long data type can hold values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807, using 64 bits. It should be able to hold 9,999,999,999. Are you sure that you are treating that value as a long in all places?

    0 讨论(0)
提交回复
热议问题