- Java.math package classes
- Java.math - Home
- Java.math - BigDecimal
- Java.math - BigInteger
- Java.math - MathContext
- Java.math package extras
- Java.math - Enumerations
- Java.math - Discussion
Java.math.BigInteger.min() Method
Description
The java.math.BigInteger.min(BigInteger val) returns the minimum of this BigInteger and val.
Declaration
Following is the declaration for java.math.BigInteger.min() method.
public BigInteger min(BigInteger val)
Parameters
val − Value with which the minimum is to be computed.
Return Value
This method returns the BigInteger whose value is the lesser of this BigInteger and val. If they are equal, either may be returned.
Exception
NA
Example
The following example shows the usage of math.BigInteger.min() method.
package com.tutorialspoint; import java.math.*; public class BigIntegerDemo { public static void main(String[] args) { // create 3 BigInteger objects BigInteger bi1, bi2, bi3; bi1 = new BigInteger("123"); bi2 = new BigInteger("1000"); // assign the min value of bi1, bi2 to bi3 bi3 = bi1.min(bi2); String str = "Minimum Value among " + bi1 + " and "+ bi2+" is "+ bi3; // print the minimum value System.out.println( str ); } }
Let us compile and run the above program, this will produce the following result −
Minimum Value among 123 and 1000 is 123
java_math_biginteger.htm
Advertisements
To Continue Learning Please Login
Login with Google