Input of big number to avoid NumberFormatException

我的未来我决定 提交于 2019-12-02 23:33:26

问题


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 numbers of this size?


回答1:


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?



来源:https://stackoverflow.com/questions/9198523/input-of-big-number-to-avoid-numberformatexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!