# Do math operation for BigDecimal : BigDecimal « Data Type « Java

Do math operation for BigDecimal

```

import java.math.BigDecimal;

public class Main {
public static void main(String[] args) {
BigDecimal decimalA = new BigDecimal("123456789012345");
BigDecimal decimalB = new BigDecimal("10");

System.out.println("decimalA = " + decimalA);

decimalA = decimalA.multiply(decimalB);
System.out.println("decimalA = " + decimalA);

decimalA = decimalA.subtract(decimalB);
System.out.println("decimalA = " + decimalA);

decimalA = decimalA.divide(decimalB);
System.out.println("decimalA = " + decimalA);

decimalA = decimalA.pow(2);
System.out.println("decimalA = " + decimalA);

decimalA = decimalA.negate();
System.out.println("decimalA = " + decimalA);
}
}

```

### Related examples in the same category

 1 Round a double 2 Create Big Decimal Values via a long 3 Create a BigDecimal vis string 4 Multiply one BigDecimal to another BigDecimal 5 Subtract from one BigDecimal another BigDecimal 6 Divide one BigDecimal from another BigDecimal 7 Negate a BigDecimal 8 Setting the Decimal Place of a Big Decimal Value 9 Truncates the big decimal value 10 Operate with big decimal values 11 Round a double by setting the scale 12 Create Big Decimal Values via a string 13 Calculation with BigDecimal 14 Parse BigDecimal 15 Formats BigDecimal into a SQL floating-point literal 16 Value is rounded using the given method which is any method defined in BigDecimal 17 Round the given value to the specified number of decimal places. The value is rounded using the BigDecimal.ROUND_HALF_UP method. 18 Convert Object to BigDecimal 19 BigDecimal and BigInteger sqare root 20 BigDecimal quadratic