List of usage examples for java.math MathContext MathContext
public MathContext(String val)
From source file:Main.java
public static void main(String[] args) { MathContext mc = new MathContext(3); BigDecimal bg1 = new BigDecimal(123.456789, mc); System.out.println(bg1);// w ww.j av a2 s.c om }
From source file:Main.java
public static void main(String[] args) { MathContext mc = new MathContext(3); BigDecimal bg1 = new BigDecimal(123456789L, mc); System.out.println(bg1);//w w w .j a va 2 s . c o m }
From source file:Main.java
public static void main(String[] args) { MathContext mc = new MathContext(3); BigDecimal bg1 = new BigDecimal(123, mc); System.out.println(bg1);//from w w w . j av a 2s .co m }
From source file:Main.java
public static void main(String[] args) { MathContext mc = new MathContext(3); BigDecimal bg1 = new BigDecimal("123", mc); System.out.println(bg1);//from w w w . j a v a 2 s .com }
From source file:Main.java
public static void main(String[] args) { MathContext mc = new MathContext(3); // 3 precision BigDecimal bg = new BigDecimal("1234E4", mc); System.out.println(bg.toString()); }
From source file:Main.java
public static void main(String[] args) { MathContext mc = new MathContext(3); char[] ch = new char[] { '1', '2', '3', '4', '5', '6', '7' }; BigDecimal bg1 = new BigDecimal(ch, 2, 3, mc); System.out.println(bg1);/*w w w .j ava 2s . c o m*/ }
From source file:Main.java
public static void main(String[] args) { MathContext mc = new MathContext(3); char[] ch = new char[] { '1', '2', '3', '4', '5', '6', '7' }; BigDecimal bg1 = new BigDecimal(ch, mc); System.out.println(bg1);/*from w w w . j a va 2 s. com*/ }
From source file:Main.java
public static void main(String[] args) { MathContext mc = new MathContext(3); // 3 precision BigDecimal bg = new BigDecimal("1234E+4", mc); System.out.println("Plain string value of " + bg + " is " + bg.toPlainString()); }
From source file:Main.java
public static void main(String[] args) { MathContext mc = new MathContext(4); // 4 precision BigDecimal bg1 = new BigDecimal("2.17"); BigDecimal bg2 = bg1.pow(3, mc); System.out.println(bg2);//from w w w .j a va2 s . c o m }
From source file:Main.java
public static void main(String[] args) { MathContext mc = new MathContext(4); // 4 precision BigDecimal bg1 = new BigDecimal("1.230"); BigDecimal bg2 = new BigDecimal("4.560"); // multiply bg1 with bg2 using mc BigDecimal bg3 = bg1.multiply(bg2, mc); System.out.println(bg3);//from w w w .jav a 2 s .c om }