Description Of BigDecimal: remainder(BigDecimal divisor)
The java.math.BigDecimal.remainder(BigDecimal divisor) returns a BigDecimal whose value is (this % divisor).The remainder is given by this.subtract(this.divideToIntegralValue(divisor).multiply(divisor)) . Note that this is not the modulo operation (the result can be negative).
BigDecimal.remainder(BigDecimal divisor) method returns this % divisor.
Code Example Java BigDecimal
import java.math.BigDecimal; public class BigDecimalExam { public static void main(String[] args) { BigDecimal bg1 = new BigDecimal("123.234"); BigDecimal bg2 = new BigDecimal("523.0"); BigDecimal bg3 = bg1.remainder(bg2); String str = "The remainder is " + bg3; // print the value of bg3 System.out.println(str); } }
ไม่มีความคิดเห็น :
แสดงความคิดเห็น