1. <legend id='G6leq'><style id='G6leq'><dir id='G6leq'><q id='G6leq'></q></dir></style></legend>

        <i id='G6leq'><tr id='G6leq'><dt id='G6leq'><q id='G6leq'><span id='G6leq'><b id='G6leq'><form id='G6leq'><ins id='G6leq'></ins><ul id='G6leq'></ul><sub id='G6leq'></sub></form><legend id='G6leq'></legend><bdo id='G6leq'><pre id='G6leq'><center id='G6leq'></center></pre></bdo></b><th id='G6leq'></th></span></q></dt></tr></i><div id='G6leq'><tfoot id='G6leq'></tfoot><dl id='G6leq'><fieldset id='G6leq'></fieldset></dl></div>

        <small id='G6leq'></small><noframes id='G6leq'>

        • <bdo id='G6leq'></bdo><ul id='G6leq'></ul>
      2. <tfoot id='G6leq'></tfoot>

        Java中的大数

        Large Numbers in Java(Java中的大数)

          <i id='cGpGx'><tr id='cGpGx'><dt id='cGpGx'><q id='cGpGx'><span id='cGpGx'><b id='cGpGx'><form id='cGpGx'><ins id='cGpGx'></ins><ul id='cGpGx'></ul><sub id='cGpGx'></sub></form><legend id='cGpGx'></legend><bdo id='cGpGx'><pre id='cGpGx'><center id='cGpGx'></center></pre></bdo></b><th id='cGpGx'></th></span></q></dt></tr></i><div id='cGpGx'><tfoot id='cGpGx'></tfoot><dl id='cGpGx'><fieldset id='cGpGx'></fieldset></dl></div>
              <bdo id='cGpGx'></bdo><ul id='cGpGx'></ul>
              <tfoot id='cGpGx'></tfoot>
                <tbody id='cGpGx'></tbody>
            • <legend id='cGpGx'><style id='cGpGx'><dir id='cGpGx'><q id='cGpGx'></q></dir></style></legend>

                  <small id='cGpGx'></small><noframes id='cGpGx'>

                  本文介绍了Java中的大数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如何在 Java 中进行非常大的数字计算?

                  How would I go about doing calculations with extremely large numbers in Java?

                  我已经尝试过 long,但它的最大值为 9223372036854775807,当使用整数时,它不能保存足够的数字,因此对于我的需要来说不够准确.

                  I have tried long but that maxes out at 9223372036854775807, and when using an integer it does not save enough digits and therefore is not accurate enough for what I need.

                  这里面还有吗?

                  推荐答案

                  您可以将 BigInteger 类用于整数,BigDecimal 用于带有小数位的数字.这两个类都定义在 java.math 包中.

                  You can use the BigInteger class for integers and BigDecimal for numbers with decimal digits. Both classes are defined in java.math package.

                  例子:

                  BigInteger reallyBig = new BigInteger("1234567890123456890");
                  BigInteger notSoBig = new BigInteger("2743561234");
                  reallyBig = reallyBig.add(notSoBig);
                  

                  这篇关于Java中的大数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                  How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                  Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                  Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                  How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                  How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)

                  1. <i id='VzGsf'><tr id='VzGsf'><dt id='VzGsf'><q id='VzGsf'><span id='VzGsf'><b id='VzGsf'><form id='VzGsf'><ins id='VzGsf'></ins><ul id='VzGsf'></ul><sub id='VzGsf'></sub></form><legend id='VzGsf'></legend><bdo id='VzGsf'><pre id='VzGsf'><center id='VzGsf'></center></pre></bdo></b><th id='VzGsf'></th></span></q></dt></tr></i><div id='VzGsf'><tfoot id='VzGsf'></tfoot><dl id='VzGsf'><fieldset id='VzGsf'></fieldset></dl></div>
                        <legend id='VzGsf'><style id='VzGsf'><dir id='VzGsf'><q id='VzGsf'></q></dir></style></legend>

                        <small id='VzGsf'></small><noframes id='VzGsf'>

                          <bdo id='VzGsf'></bdo><ul id='VzGsf'></ul>
                          <tfoot id='VzGsf'></tfoot>
                            <tbody id='VzGsf'></tbody>