1. <i id='xHD5Y'><tr id='xHD5Y'><dt id='xHD5Y'><q id='xHD5Y'><span id='xHD5Y'><b id='xHD5Y'><form id='xHD5Y'><ins id='xHD5Y'></ins><ul id='xHD5Y'></ul><sub id='xHD5Y'></sub></form><legend id='xHD5Y'></legend><bdo id='xHD5Y'><pre id='xHD5Y'><center id='xHD5Y'></center></pre></bdo></b><th id='xHD5Y'></th></span></q></dt></tr></i><div id='xHD5Y'><tfoot id='xHD5Y'></tfoot><dl id='xHD5Y'><fieldset id='xHD5Y'></fieldset></dl></div>
  2. <small id='xHD5Y'></small><noframes id='xHD5Y'>

    <legend id='xHD5Y'><style id='xHD5Y'><dir id='xHD5Y'><q id='xHD5Y'></q></dir></style></legend>

      <tfoot id='xHD5Y'></tfoot>

        <bdo id='xHD5Y'></bdo><ul id='xHD5Y'></ul>
    1. 如何在 Java 中舍入 *down* 整数?

      How to round *down* integers in Java?(如何在 Java 中舍入 *down* 整数?)
        <tbody id='BM9Ya'></tbody>

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

              <legend id='BM9Ya'><style id='BM9Ya'><dir id='BM9Ya'><q id='BM9Ya'></q></dir></style></legend>

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

              • <bdo id='BM9Ya'></bdo><ul id='BM9Ya'></ul>

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

                问题描述

                我想在 Java 中将整数向下舍入到最接近的 1000.

                I'd like to round integers down to their nearest 1000 in Java.

                例如:

                • 13,623 轮到 13,000 轮
                • 18,999 轮到 18,000 轮

                推荐答案

                简单地除以1000去掉你不感兴趣的数字,再乘以1000:

                Simply divide by 1000 to lose the digits that are not interesting to you, and multiply by 1000:

                i = i/1000 * 1000
                

                或者,你也可以试试:

                i = i - (i % 1000)
                

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

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

                相关文档推荐

                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 中的默认语言环境设置以使其保持一致?)
                <legend id='dtaGG'><style id='dtaGG'><dir id='dtaGG'><q id='dtaGG'></q></dir></style></legend>
                      <bdo id='dtaGG'></bdo><ul id='dtaGG'></ul>

                        <tbody id='dtaGG'></tbody>

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

                          <tfoot id='dtaGG'></tfoot>