如何存储大(10位)整数? [英] How to store a large (10 digits) integer?
本文介绍了如何存储大(10位)整数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
哪种Java数据类型能够存储大数值,如9999999999?
Which Java data type would be able to store a big numerical value, like 9999999999?
推荐答案
您的具体示例可能是存储在 long
(或 java.lang.Long
,如果有必要的话)。
Your concrete example could be stored in long
(or java.lang.Long
if this is necessary).
如果您需要更大的数字,可以尝试
java.math.BigInteger
(如果是整数)或 java.math.BigDecimal
(如果是小数) )
If at any point you need bigger numbers, you can try
java.math.BigInteger
(if integer), or java.math.BigDecimal
(if decimal)
这篇关于如何存储大(10位)整数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文