bigdecimal multiply negative

Solutions on MaxInterview for bigdecimal multiply negative by the best coders in the world

showing results for - "bigdecimal multiply negative"
Robin
24 Mar 2016
1package com.tutorialspoint;
2
3import java.math.*;
4
5public class BigDecimalDemo {
6
7   public static void main(String[] args) {
8
9      // create 2 BigDecimal objects
10      BigDecimal bg1, bg2;
11
12      // assign value to bg1
13      bg1 = new BigDecimal("40.1264");
14
15      // assign negate value of bg1 to bg2
16      bg2 = bg1.negate();
17
18      String str = "Negated value of " + bg1 + " is "+ bg2;
19
20      // print bg1 and bg2 values
21      System.out.println( str );
22   }
23}