fork(1) download
  1. import java.math.*;
  2.  
  3. final public class Main
  4. {
  5. public static void main(String[] args)
  6. {
  7. BigDecimal a = new BigDecimal(2);
  8. BigDecimal b = new BigDecimal(3);
  9.  
  10. System.out.println(a.multiply(b));
  11. System.out.println(a.add(b));
  12. System.out.println(b.subtract(a));
  13. System.out.println(a.divide(b, 20, RoundingMode.HALF_UP));
  14. }
  15. }
  16.  
Success #stdin #stdout 0.03s 245632KB
stdin
Standard input is empty
stdout
6
5
1
0.66666666666666666667