Java Data Type Tutorial - Java BigDecimal.min(BigDecimal val)








Syntax

BigDecimal.min(BigDecimal val) has the following syntax.

public BigDecimal min(BigDecimal val)

Example

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

/*from   w  w  w  .  j  a  v  a  2 s  . c  om*/


import java.math.BigDecimal;

public class Main {

  public static void main(String[] args) {

    BigDecimal bg1 = new BigDecimal("123");
    BigDecimal bg2 = new BigDecimal("456");

    BigDecimal bg3 = bg1.min(bg2);

    System.out.println(bg3);
  }
}

The code above generates the following result.