# Class BigDecimal

java.lang.Object
com.codename1.util.BigDecimal

public class BigDecimal extends java.lang.Object
Class representing a simple version of a big decimal. A `BigDecimal` is basically a `BigInteger` with a few digits on the right of the decimal point. The number of (binary) digits on the right of the decimal point is called the `scale` of the `BigDecimal`. Unlike in `BigDecimal`, the scale is not adjusted automatically, but must be set manually. All `BigDecimal`s taking part in the same arithmetic operation must have equal scale. The result of a multiplication of two `BigDecimal`s returns a `BigDecimal` with double scale.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BigDecimal(BigInteger bigInt, int scale)`
  Constructor for `BigDecimal`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `BigDecimal`
  `add(BigDecimal b)`
  `BigDecimal`
  `add(BigInteger b)`
  `BigDecimal`
  `adjustScale(int newScale)`
  `int`
  `compareTo(BigDecimal val)`
  `int`
  `compareTo(BigInteger val)`
  `BigDecimal`
  `divide(BigDecimal b)`
  `BigDecimal`
  `divide(BigInteger b)`
  `boolean`
  `equals(java.lang.Object o)`
  `BigInteger`
  `floor()`
  `static BigDecimal`
  `getInstance(BigInteger value, int scale)`
  Returns a `BigDecimal` with value `value / 2scale / 10scale`
  `int`
  `getScale()`
  `int`
  `hashCode()`
  `int`
  `intValue()`
  `long`
  `longValue()`
  `BigDecimal`
  `multiply(BigDecimal b)`
  `BigDecimal`
  `multiply(BigInteger b)`
  `BigDecimal`
  `negate()`
  `BigInteger`
  `round()`
  `BigDecimal`
  `shiftLeft(int n)`
  `BigDecimal`
  `subtract(BigDecimal b)`
  `BigDecimal`
  `subtract(BigInteger b)`
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### BigDecimal

    public BigDecimal(BigInteger bigInt, int scale)

    Constructor for `BigDecimal`. The value of the constructed `BigDecimal` equals `bigInt / 10scale`.

    ###### Parameters

    - `bigInt`: The `bigInt` value parameter.

    - `scale`: The scale of the constructed `BigDecimal`.

- ## Method Details

  - ### getInstance

    public static BigDecimal getInstance(BigInteger value, int scale)

    Returns a `BigDecimal` with value `value / 2scale / 10scale`

    ###### Parameters

    - `value`: @param value The value of the `BigDecimal` to be created.

    - `scale`: @param scale The scale of the `BigDecimal` to be created.

    ###### Returns

    The such created `BigDecimal`.

    ###### Deprecated

  - ### adjustScale

    public BigDecimal adjustScale(int newScale)

  - ### add

    public BigDecimal add(BigDecimal b)

  - ### add

    public BigDecimal add(BigInteger b)

  - ### negate

    public BigDecimal negate()

  - ### subtract

    public BigDecimal subtract(BigDecimal b)

  - ### subtract

    public BigDecimal subtract(BigInteger b)

  - ### multiply

    public BigDecimal multiply(BigDecimal b)

  - ### multiply

    public BigDecimal multiply(BigInteger b)

  - ### divide

    public BigDecimal divide(BigDecimal b)

  - ### divide

    public BigDecimal divide(BigInteger b)

  - ### shiftLeft

    public BigDecimal shiftLeft(int n)

  - ### compareTo

    public int compareTo(BigDecimal val)

  - ### compareTo

    public int compareTo(BigInteger val)

  - ### floor

    public BigInteger floor()

  - ### round

    public BigInteger round()

  - ### intValue

    public int intValue()

  - ### longValue

    public long longValue()

  - ### getScale

    public int getScale()

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `java.lang.Object`

  - ### equals

    public boolean equals(java.lang.Object o)
    Overrides:
      `equals` in class `java.lang.Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `java.lang.Object`