Example usage for java.math BigDecimal BigDecimal

List of usage examples for java.math BigDecimal BigDecimal

Introduction

In this page you can find the example usage for java.math BigDecimal BigDecimal.

Prototype

public BigDecimal(BigInteger unscaledVal, int scale, MathContext mc) 

Source Link

Document

Translates a BigInteger unscaled value and an int scale into a BigDecimal , with rounding according to the context settings.

Usage

From source file:Main.java

public static void main(String[] args) {
    char[] ch = new char[] { '1', '2', '3', '4', '5', '6', '7' };
    BigDecimal bg1 = new BigDecimal(ch, 2, 3);
    System.out.println(bg1);/*from w  ww  .  j  a v a2s .  c  o m*/

}

From source file:Main.java

public static void main(String[] args) {
    MathContext mc = new MathContext(3);
    BigDecimal bg1 = new BigDecimal(new BigInteger("40"), 2, mc);

}