Java Math BigInteger.min() 方法


Java Math BigInteger.min() 方法

package com.codingdict;



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 );

   }

}