Java BigDecimal.toBigInteger()

Syntax

BigDecimal.toBigInteger() has the following syntax.

public BigInteger toBigInteger()

Example

In the following code shows how to use BigDecimal.toBigInteger() method.


/*from  w  ww.  j ava  2s. c o m*/

import java.math.BigDecimal;
import java.math.BigInteger;

public class Main {

  public static void main(String[] args) {

    BigDecimal bg1 = new BigDecimal("235.738");

    BigInteger i1 = bg1.toBigInteger();

    
    System.out.println("BigInteger value of " + bg1 + " is " + i1);
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.math »




BigDecimal
BigInteger