Java BigDecimal scale()方法与示例

本文介绍了Java中的BigDecimal类的scale()方法,该方法用于获取BigDecimal对象的小数位数。当BigDecimal为0或正数时,标度表示小数点右侧的位数;对于负数,标度表示未缩放值乘以10的幂。scale()方法是非静态的,需要通过类对象调用,且在缩放过程中不会抛出异常。
摘要由CSDN通过智能技术生成

BigDecimal Class scale()方法 (BigDecimal Class scale() method)

  • scale() method is available in java.math package.

    scale()方法在java.math包中可用。

  • scale() method is used to get the scale of this BigDecimal object. As we will define the scale when this BigInteger is 0, +ve,-ve.

    scale()方法用于获取此BigDecimal对象的比例。 由于我们将在此BigInteger为0,+ ve,-ve时定义比例。

    • Case 1: The scale is the number of digits represented to the right side of decimal when this BigDecimal is 0 or +ve.
    • Case 2: The scale is the unscaled value of the [number * 10 pow (-[-( this BigDecimal)]).
  • scale() method is a non-static method, it is accessible with the class object only and if we try to access the meth

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值