• <small id='TJIEx'></small><noframes id='TJIEx'>

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

        <bdo id='TJIEx'></bdo><ul id='TJIEx'></ul>
      <legend id='TJIEx'><style id='TJIEx'><dir id='TJIEx'><q id='TJIEx'></q></dir></style></legend>
      <tfoot id='TJIEx'></tfoot>

      1. 将 BigDecimal 转换为 Integer

        时间:2023-05-28
        • <legend id='SjCOl'><style id='SjCOl'><dir id='SjCOl'><q id='SjCOl'></q></dir></style></legend>

              <bdo id='SjCOl'></bdo><ul id='SjCOl'></ul>

                  <tfoot id='SjCOl'></tfoot>

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

                    <tbody id='SjCOl'></tbody>
                2. 本文介绍了将 BigDecimal 转换为 Integer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有 Hibernate 方法,它返回一个 BigDecimal.我有另一个 API 方法,我需要将该数字传递给它,但它接受 Integer 作为参数.我无法更改这两种方法的返回类型或变量类型.

                  I have Hibernate method which returns me a BigDecimal. I have another API method to which I need to pass that number but it accepts Integer as parameter. I cannot change return types or variable types of both methods.

                  现在如何将 BigDecimal 转换为 Integer 并将其传递给第二个方法?

                  Now how to convert the BigDecimal into Integer and pass it to second method?

                  有办法解决吗?

                  推荐答案

                  你会调用 myBigDecimal.intValueExact()(或只是 intValue()) 如果您丢失信息,它甚至会抛出异常.这会返回一个 int,但自动装箱会处理这个问题.

                  You would call myBigDecimal.intValueExact() (or just intValue()) and it will even throw an exception if you would lose information. That returns an int but autoboxing takes care of that.

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

                  上一篇:Integer.parseInt(String str) java.lang.NumberFormatException 下一篇:int 数组初始化

                  相关文章

                3. <small id='dAMt7'></small><noframes id='dAMt7'>

                    <tfoot id='dAMt7'></tfoot>
                    • <bdo id='dAMt7'></bdo><ul id='dAMt7'></ul>

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