• java BigInteger类的用法


    import java.math.BigInteger;
    
    Scanner in = new Scanner(System.in);
    BigInteger x1 = new BigInteger("-11"); //新建一个对象
    BigInteger x2 = in.nextBiginteger();//键盘输入
    BigInteger y = x1.abs(); //取绝对值
    BigInteger y2 = x1.add(y); //x+y
    int x3 = y.compareTo(x1); //x和y比较 < == >分别返回 -1,0,1
    Boolean x4 = (y.compareTo(x1) <= 0); //判断y是否<=x 0是固定不变的,<=符号可以随意变
    BigInteger x5 = y.divide(x1);  //    y/x1
    BigInteger x6 = y.multiply(x1);// y*x1
    double x6 = x2.doubleValue(); //将x2转化为double类型,转化为int用intValue()
    BigInteger x7 = x2.gcd(x1);// 返回abs(x2)和abs(x1)的最大公约数
    BigInteger x8 = x2.negate();// 返回-x2
    String x9 = x2.toString();// 将x2转化为字符串
    BigInteger y3 = x2.reamainder(x1);// 返回x2%x1
    BigInteger y4= x1.pow(2);// pow(int exponent) 返回其值为 (this^exponent) 的 BigInteger。
  • 相关阅读:
    Beans
    HDU2830
    HDU1176
    rtc关机闹钟7 jni层 com_android_server_AlarmManagerService
    rtc关机闹钟6 AlarmManagerService研究
    rtc关机闹钟5 AlarmManager研究
    数论学习_裴蜀定理
    hdu-5465-二维BIT+nim
    hdu-1892-二维BIT
    hdu-2227-dp+bit
  • 原文地址:https://www.cnblogs.com/likailiche/p/4445634.html
Copyright © 2020-2023  润新知