A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 逝水无痕zm 初级黑马   /  2015-7-22 23:32  /  234 人查看  /  0 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

我这么用对吗?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


0 个回复

您需要登录后才可以回帖 登录 | 加入黑马