BigDecimal bigDecimal1 =new BigDecimal("0.85").setScale(2, BigDecimal.ROUND_HALF_UP);
时间: 2024-01-09 09:54:18 浏览: 88
根据提供的引用内容,BigDecimal bigDecimal1 = new BigDecimal("0.85").setScale(2, BigDecimal.ROUND_HALF_UP) 的结果应该是1.24。根据引用中的输出结果,setScale方法将0.85保留两位小数,使用ROUND_HALF_UP进行四舍五入,所以结果为1.24。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* *3* [java 四舍五入BigDecimal.ROUND_HALF_DOWN和BigDecimal.ROUND_HALF_UP的区别](https://blog.csdn.net/mqdxiaoxiao/article/details/88937674)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"]
[ .reference_list ]
阅读全文