问题
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