Java Math BigInteger.max() 方法


Java Math BigInteger.max() 方法

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 max value of bi1, bi2 to bi3

      bi3 = bi1.max(bi2);



      String str = "Maximum Value among " + bi1 + " and "+ bi2+" is "+ bi3;



      // print the maximum value

      System.out.println( str );

   }

}