Description Of BigDecimal: divide(BigDecimal divisor, MathContext mc)
The java.math.BigDecimal.divide(BigDecimal divisor, MathContext mc) returns a BigDecimal whose value is (this / divisor) , with rounding according to the context settingsBigDecimal.divide(BigDecimal divisor, MathContext mc) method returns this / divisor , rounded as necessary.
Code Example Java BigDecimal
import java.math.BigDecimal; import java.math.MathContext; public class BigDecimalExam { public static void main(String[] args) { BigDecimal bg1 = new BigDecimal("10"); BigDecimal bg2 = new BigDecimal("3"); MathContext mc = new MathContext(3); BigDecimal bg3 = bg1.divide(bg2, mc); System.out.println(bg3); } }
ไม่มีความคิดเห็น :
แสดงความคิดเห็น