Description Of BigDecimal: divide(BigDecimal divisor)
The java.math.BigDecimal.divide(BigDecimal divisor) returns a BigDecimal whose value is (this / divisor) , and whose preferred scale is (this.scale() - divisor.scale()) ; if the exact quotient cannot be represented (because it has a non-terminating decimal expansion) an ArithmeticException is thrown.BigDecimal.divide(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("5"); BigDecimal bg2 = new BigDecimal("10"); BigDecimal bg3 = bg1.divide(bg2); // divide bg1 with bg2 System.out.println(bg3); } }
ไม่มีความคิดเห็น :
แสดงความคิดเห็น