JAVA中大数经常使用的函数
声明为 BigInteger 的 java.math 中的字段
static BigInteger BigInteger. ONE
BigInteger 的常量 1。
static BigInteger BigInteger. TEN
BigInteger 的常量 10。
static BigInteger BigInteger. ZERO
BigInteger 的常量 0。 返回 BigInteger 的 java.math 中的方法
BigInteger BigInteger. abs ()
返回其值是此 BigInteger 的绝对值的 BigInteger。
BigInteger BigInteger. add (BigInteger val)
返回其值为 (this + val) 的 BigInteger。
BigInteger BigInteger. and (BigInteger val)
返回其值为 (this & val) 的 BigInteger。
BigInteger BigInteger. andNot (BigInteger val)
返回其值为 (this & ~val) 的 BigInteger。 BigInteger BigInteger. clearBit (int n)
返回其值与清除了指定位的此 BigInteger 等效的 BigInteger。 BigInteger BigInteger. divide (BigInteger val)
返回其值为 (this / val) 的 BigInteger。 BigInteger [] BigInteger. divideAndRemainder (BigInteger val)
返回包括 (this / val) 后跟 (this % val) 的两个 BigInteger 的数组。
BigInteger BigInteger. flipBit (int n)
返回其值与对此 BigInteger 进行指定位翻转后的值等效的 BigInteger。 BigInteger BigInteger. gcd (BigInteger val)
返回一个 BigInteger。其值是 abs(this) 和 abs(val) 的最大公约数。
BigInteger BigInteger. max (BigInteger val)
返回此 BigInteger 和 val 的最大值。
BigInteger BigInteger. min (BigInteger val)
返回此 BigInteger 和 val 的最小值。
BigInteger BigInteger. mod (BigInteger m)
返回其值为 (this mod m ) 的 BigInteger。
BigInteger BigInteger. modInverse (BigInteger m)
返回其值为 (this-1 mod m) 的 BigInteger。
BigInteger BigInteger. modPow (BigInteger exponent, BigInteger m)
返回其值为 (thisexponent mod m) 的 BigInteger。 BigInteger BigInteger. multiply (BigInteger val)
返回其值为 (this * val) 的 BigInteger。
BigInteger BigInteger. negate ()
返回其值是 (-this) 的 BigInteger。 BigInteger BigInteger. nextProbablePrime ()
返回大于此 BigInteger 的可能为素数的第一个整数。
BigInteger BigInteger. not ()
返回其值为 (~this) 的 BigInteger。 BigInteger BigInteger. or (BigInteger val)
返回其值为 (this | val) 的 BigInteger。
BigInteger BigInteger. pow (int exponent)
返回其值为 (thisexponent ) 的 BigInteger。
static BigInteger BigInteger. probablePrime (int bitLength, Random rnd)
返回有可能是素数的、具有指定长度的正 BigInteger。
BigInteger BigInteger. remainder (BigInteger val)
返回其值为 (this % val) 的 BigInteger。
BigInteger BigInteger. setBit (int n)
返回其值与设置了指定位的此 BigInteger 等效的 BigInteger。 BigInteger BigInteger. shiftLeft (int n)
返回其值为 (this << n) 的 BigInteger。
BigInteger BigInteger. shiftRight (int n)
返回其值为 (this >> n) 的 BigInteger。
BigInteger BigInteger. subtract (BigInteger val)
返回其值为 (this - val) 的 BigInteger。
BigInteger BigDecimal. toBigInteger ()
将此 BigDecimal 转换为 BigInteger 。
BigInteger BigDecimal. toBigIntegerExact ()
将此 BigDecimal 转换为 BigInteger ,以检查丢失的信息。
BigInteger BigDecimal. unscaledValue ()
返回其值为此 BigDecimal 的非标度值 的 BigInteger 。
static BigInteger BigInteger. valueOf (long val)
返回其值等于指定 long 的值的 BigInteger。
BigInteger BigInteger. xor (BigInteger val)
返回其值为 (this ^ val) 的 BigInteger。
參数类型为 BigInteger 的 java.math 中的方法
BigInteger BigInteger. add (BigInteger val)
返回其值为 (this + val) 的 BigInteger。
BigInteger BigInteger. and (BigInteger val)
返回其值为 (this & val) 的 BigInteger。
BigInteger BigInteger. andNot (BigInteger val)
返回其值为 (this & ~val) 的 BigInteger。
int BigInteger. compareTo (BigInteger val)
将此 BigInteger 与指定的 BigInteger 进行比較。
BigInteger BigInteger. divide (BigInteger val)
返回其值为 (this / val) 的 BigInteger。 BigInteger [] BigInteger. divideAndRemainder (BigInteger val)
返回包括 (this / val) 后跟 (this % val) 的两个 BigInteger 的数组。
BigInteger BigInteger. gcd (BigInteger val)
返回一个 BigInteger。其值是 abs(this) 和 abs(val) 的最大公约数。 BigInteger BigInteger. max (BigInteger val)
返回此 BigInteger 和 val 的最大值。
BigInteger BigInteger. min (BigInteger val)
返回此 BigInteger 和 val 的最小值。
BigInteger BigInteger. mod (BigInteger m)
返回其值为 (this mod m ) 的 BigInteger。 BigInteger BigInteger. modInverse (BigInteger m)
返回其值为 (this-1 mod m) 的 BigInteger。
BigInteger BigInteger. modPow (BigInteger exponent, BigInteger m)
返回其值为 (thisexponent mod m) 的 BigInteger。
BigInteger BigInteger. multiply (BigInteger val)
返回其值为 (this * val) 的 BigInteger。 BigInteger BigInteger. or (BigInteger val)
返回其值为 (this | val) 的 BigInteger。
BigInteger BigInteger. remainder (BigInteger val)
返回其值为 (this % val) 的 BigInteger。
BigInteger BigInteger. subtract (BigInteger val)
返回其值为 (this - val) 的 BigInteger。
BigInteger BigInteger. xor (BigInteger val)
返回其值为 (this ^ val) 的 BigInteger。 參数类型为 BigInteger 的 java.math 中的构造方法
BigDecimal (BigInteger val)
将 BigInteger 转换为 BigDecimal 。
BigDecimal (BigInteger unscaledVal, int scale)
将 BigInteger 非标度值和 int 标度转换为 BigDecimal 。 BigDecimal (BigInteger unscaledVal, int scale, MathContext mc)
将 BigInteger 非标度值和 int 标度转换为 BigDecimal (依据上下文设置进行舍入)。
BigDecimal (BigInteger val, MathContext mc)
将 BigInteger 转换为 BigDecimal (依据上下文设置进行舍入)。 java.util 中 BigInteger 的使用 返回 BigInteger 的 java.util 中的方法
BigInteger Scanner. nextBigInteger ()
将输入信息的下一个标记扫描为一个 BigInteger 。 BigInteger Scanner. nextBigInteger (int radix)
将输入信息的下一个标记扫描为一个 BigInteger 。 java.math 中 BigDecimal 的使用
声明为 BigDecimal 的 java.math 中的字段
static BigDecimal BigDecimal. ONE
值为 1,标度为 0。 static BigDecimal BigDecimal. TEN
值为 10,标度为 0。
static BigDecimal BigDecimal. ZERO
值为 0,标度为 0。 返回 BigDecimal 的 java.math 中的方法
BigDecimal BigDecimal. abs ()
返回 BigDecimal ,其值为此 BigDecimal 的绝对值,其标度为 this.scale() 。 BigDecimal BigDecimal. abs (MathContext mc)
返回其值为此 BigDecimal 绝对值的 BigDecimal (依据上下文设置进行舍入)。
BigDecimal BigDecimal. add (BigDecimal augend)
返回一个 BigDecimal ,其值为 (this + augend) ,其标度为 max(this.scale(), augend.scale()) 。 BigDecimal BigDecimal. add (BigDecimal augend, MathContext mc)
返回其值为 (this + augend) 的 BigDecimal (依据上下文设置进行舍入)。
BigDecimal BigDecimal. divide (BigDecimal divisor)
返回一个 BigDecimal ,其值为 (this / divisor) ,其首选标度为 (this.scale() - divisor.scale()) ;假设无法表示准确的商值(由于它有无穷的十进制扩展),则抛出 ArithmeticException 。
BigDecimal BigDecimal. divide (BigDecimal divisor, int roundingMode)
返回一个 BigDecimal ,其值为 (this / divisor) ,其标度为 this.scale() 。
BigDecimal BigDecimal. divide (BigDecimal divisor, int scale, int roundingMode)
返回一个 BigDecimal 。其值为 (this / divisor) ,其标度为指定标度。 BigDecimal BigDecimal. divide (BigDecimal divisor, int scale, RoundingMode roundingMode)
返回一个 BigDecimal ,其值为 (this / divisor) ,其标度为指定标度。
BigDecimal BigDecimal. divide (BigDecimal divisor, MathContext mc)
返回其值为 (this / divisor) 的 BigDecimal (依据上下文设置进行舍入)。
BigDecimal BigDecimal. divide (BigDecimal divisor, RoundingMode roundingMode)
返回一个 BigDecimal ,其值为 (this / divisor) 。其标度为 this.scale() 。
BigDecimal [] BigDecimal. divideAndRemainder (BigDecimal divisor)
返回由两个元素组成的 BigDecimal 数组,该数组包括 divideToIntegralValue 的结果,后跟对两个操作数计算所得到的 remainder 。 BigDecimal [] BigDecimal. divideAndRemainder (BigDecimal divisor, MathContext mc)
返回由两个元素组成的 BigDecimal 数组,该数组包括 divideToIntegralValue 的结果,后跟依据上下文设置对两个操作数进行舍入计算所得到的 remainder 的结果。 BigDecimal BigDecimal. divideToIntegralValue (BigDecimal divisor)
返回 BigDecimal 。其值为向下舍入所得商值 (this / divisor) 的整数部分。
BigDecimal BigDecimal. divideToIntegralValue (BigDecimal divisor, MathContext mc)
返回 BigDecimal 。其值为 (this / divisor) 的整数部分。 BigDecimal BigDecimal. max (BigDecimal val)
返回此 BigDecimal 和 val 的最大值。
BigDecimal BigDecimal. min (BigDecimal val)
返回此 BigDecimal 和 val 的最小值。 BigDecimal BigDecimal. movePointLeft (int n)
返回一个 BigDecimal ,它等效于将该值的小数点向左移动 n 位。
BigDecimal BigDecimal. movePointRight (int n)
返回一个 BigDecimal 。它等效于将该值的小数点向右移动 n 位。 BigDecimal BigDecimal. multiply (BigDecimal multiplicand)
返回一个 BigDecimal ,其值为 (this × multiplicand) ,其标度为 (this.scale() + multiplicand.scale()) 。
BigDecimal BigDecimal. multiply (BigDecimal multiplicand, MathContext mc)
返回其值为 (this × multiplicand) 的 BigDecimal (依据上下文设置进行舍入)。 BigDecimal BigDecimal. negate ()
返回 BigDecimal 。其值为 (-this) ,其标度为 this.scale() 。
BigDecimal BigDecimal. negate (MathContext mc)
返回其值为 (-this) 的 BigDecimal (依据上下文设置进行舍入)。 BigDecimal BigDecimal. plus ()
返回 BigDecimal ,其值为 (+this) ,其标度为 this.scale() 。
BigDecimal BigDecimal. plus (MathContext mc)
返回其值为 (+this) 的 BigDecimal (依据上下文设置进行舍入)。
BigDecimal BigDecimal. pow (int n)
返回其值为 (thisn ) 的 BigDecimal 。准确计算该幂,使其具有无限精度。 BigDecimal BigDecimal. pow (int n, MathContext mc)
返回其值为 (thisn ) 的 BigDecimal 。 BigDecimal BigDecimal. remainder (BigDecimal divisor)
返回其值为 (this % divisor) 的 BigDecimal 。
BigDecimal BigDecimal. remainder (BigDecimal divisor, MathContext mc)
返回其值为 (this % divisor) 的 BigDecimal (依据上下文设置进行舍入)。
BigDecimal BigDecimal. round (MathContext mc)
返回依据 MathContext 设置进行舍入后的 BigDecimal 。
BigDecimal BigDecimal. scaleByPowerOfTen (int n)
返回其数值等于 (this * 10n ) 的 BigDecimal。
BigDecimal BigDecimal. setScale (int newScale)
返回一个 BigDecimal ,其标度为指定值。其值在数值上等于此 BigDecimal 的值。
BigDecimal BigDecimal. setScale (int newScale, int roundingMode)
返回一个 BigDecimal ,其标度为指定值,其非标度值通过此 BigDecimal 的非标度值乘以或除以十的适当次幂来确定。以维护其总值。
BigDecimal BigDecimal. setScale (int newScale, RoundingMode roundingMode)
返回 BigDecimal ,其标度为指定值,其非标度值通过此 BigDecimal 的非标度值乘以或除以十的适当次幂来确定。以维护其总值。
BigDecimal BigDecimal. stripTrailingZeros ()
返回数值上等于此小数。但从该表示形式移除全部尾部零的 BigDecimal 。
BigDecimal BigDecimal. subtract (BigDecimal subtrahend)
返回一个 BigDecimal ,其值为 (this - subtrahend) 。其标度为 max(this.scale(), subtrahend.scale()) 。
BigDecimal BigDecimal. subtract (BigDecimal subtrahend, MathContext mc)
返回其值为 (this - subtrahend) 的 BigDecimal (依据上下文设置进行舍入)。
BigDecimal BigDecimal. ulp ()
返回此 BigDecimal 的 ulp(最后一位的单位)的大小。 static BigDecimal BigDecimal. valueOf (double val)
使用 Double.toString(double) 方法提供的 double 规范的字符串表示形式将 double 转换为 BigDecimal 。 static BigDecimal BigDecimal. valueOf (long val)
将 long 值转换为具有零标度的 BigDecimal 。
static BigDecimal BigDecimal. valueOf (long unscaledVal, int scale)
将 long 非标度值和 int 标度转换为 BigDecimal 。
參数类型为 BigDecimal 的 java.math 中的方法
BigDecimal BigDecimal. add (BigDecimal augend)
返回一个 BigDecimal ,其值为 (this + augend) ,其标度为 max(this.scale(), augend.scale()) 。
BigDecimal BigDecimal. add (BigDecimal augend, MathContext mc)
返回其值为 (this + augend) 的 BigDecimal (依据上下文设置进行舍入)。 int BigDecimal. compareTo (BigDecimal val)
将此 BigDecimal 与指定的 BigDecimal 比較。 BigDecimal BigDecimal. divide (BigDecimal divisor)
返回一个 BigDecimal ,其值为 (this / divisor) 。其首选标度为 (this.scale() - divisor.scale()) ;假设无法表示准确的商值(由于它有无穷的十进制扩展)。则抛出 ArithmeticException 。
BigDecimal BigDecimal. divide (BigDecimal divisor, int roundingMode)
返回一个 BigDecimal ,其值为 (this / divisor) ,其标度为 this.scale() 。
BigDecimal BigDecimal. divide (BigDecimal divisor, int scale, int roundingMode)
返回一个 BigDecimal ,其值为 (this / divisor) ,其标度为指定标度。 BigDecimal BigDecimal. divide (BigDecimal divisor, int scale, RoundingMode roundingMode)
返回一个 BigDecimal 。其值为 (this / divisor) 。其标度为指定标度。
BigDecimal BigDecimal. divide (BigDecimal divisor, MathContext mc)
返回其值为 (this / divisor) 的 BigDecimal (依据上下文设置进行舍入)。
BigDecimal BigDecimal. divide (BigDecimal divisor, RoundingMode roundingMode)
返回一个 BigDecimal ,其值为 (this / divisor) ,其标度为 this.scale() 。 BigDecimal [] BigDecimal. divideAndRemainder (BigDecimal divisor)
返回由两个元素组成的 BigDecimal 数组,该数组包括 divideToIntegralValue 的结果,后跟对两个操作数计算所得到的 remainder 。
BigDecimal [] BigDecimal. divideAndRemainder (BigDecimal divisor, MathContext mc)
返回由两个元素组成的 BigDecimal 数组,该数组包括 divideToIntegralValue 的结果,后跟依据上下文设置对两个操作数进行舍入计算所得到的 remainder 的结果。 BigDecimal BigDecimal. divideToIntegralValue (BigDecimal divisor)
返回 BigDecimal ,其值为向下舍入所得商值 (this / divisor) 的整数部分。
BigDecimal BigDecimal. divideToIntegralValue (BigDecimal divisor, MathContext mc)
返回 BigDecimal ,其值为 (this / divisor) 的整数部分。 BigDecimal BigDecimal. max (BigDecimal val)
返回此 BigDecimal 和 val 的最大值。
BigDecimal BigDecimal. min (BigDecimal val)
返回此 BigDecimal 和 val 的最小值。 BigDecimal BigDecimal. multiply (BigDecimal multiplicand)
返回一个 BigDecimal 。其值为 (this × multiplicand) 。其标度为 (this.scale() + multiplicand.scale()) 。
BigDecimal BigDecimal. multiply (BigDecimal multiplicand, MathContext mc)
返回其值为 (this × multiplicand) 的 BigDecimal (依据上下文设置进行舍入)。 BigDecimal BigDecimal. remainder (BigDecimal divisor)
返回其值为 (this % divisor) 的 BigDecimal 。
BigDecimal BigDecimal. remainder (BigDecimal divisor, MathContext mc)
返回其值为 (this % divisor) 的 BigDecimal (依据上下文设置进行舍入)。 BigDecimal BigDecimal. subtract (BigDecimal subtrahend)
返回一个 BigDecimal ,其值为 (this - subtrahend) ,其标度为 max(this.scale(), subtrahend.scale()) 。
BigDecimal BigDecimal. subtract (BigDecimal subtrahend, MathContext mc)
返回其值为 (this - subtrahend) 的 BigDecimal (依据上下文设置进行舍入)。 java.util 中 BigDecimal 的使用 返回 BigDecimal 的 java.util 中的方法
BigDecimal Scanner. nextBigDecimal ()
将输入信息的下一个标记扫描为一个 BigDecimal 。
JAVA中大数经常使用的函数的更多相关文章
- Java中的Random()函数-----转载
		
Java中的Random()函数 (2013-01-24 21:01:04) 转载▼ 标签: java random 随机函数 杂谈 分类: Java 今天在做Java练习的时候注意到了Java里面的 ...
 - Java中math类的常用函数
		
Java中math类的常用函数 在 Java 中 Math 类封装了常用的数学运算,提供了基本的数学操作,如指数.对数.平方根和三角函数等 只要在源文件的顶部加上下面这行代码就不必在数学方法名和常量名 ...
 - Java中的Random()函数
		
今天在做Java练习的时候注意到了Java里面的一个随机函数——Random,刚开始只是知道这个函数具有随机取值的作用,于是上网搜索了资料一番,做了一下一些关于Random函数的总结: Java中 ...
 - Java中的Random()函数 【转载】
		
今天在做Java练习的时候注意到了Java里面的一个随机函数——Random,刚开始只是知道这个函数具有随机取值的作用,于是上网搜索了资料一番,做了一下一些关于Random函数的总结: J ...
 - java中的==操作符和equals函数
		
基本规则 “==”操作符的使用需要分成两种情况 判值类型相等 这一点很好理解,两个值类型代表的数值相等,则“==”表达式返回true “==”可以用与不同值类型的比较,语言会自动进行类型转换 判引用类 ...
 - Java中大数的使用与Java入门(NCPC-Intergalactic Bidding)
		
引入 前几天参加湖南多校的比赛,其中有这样一道题,需要使用高精度,同时需要排序,如果用c++实现的话,重载运算符很麻烦,于是直接学习了一发怎样用Java写大数,同时也算是学习Java基本常识了 题目 ...
 - java中大数类的学习
		
java中提供了大数类BigInteger和BigDecimal分别表示大整数类和大浮点数类,这两个类都在java.math.*包中,因此每次必须在开头处引用该包. 一.BigInteger构造函数: ...
 - java中String字符串的替换函数:replace与replaceAll的区别
		
例如有如下x的字符串 String x = "[kllkklk\\kk\\kllkk]";要将里面的“kk”替换为++,可以使用两种方法得到相同的结果 replace(CharSe ...
 - java 中的SimpleDateFormat、Date函数以及字符串和Date类型互转
		
SimpleDateFormat是一个以与语言环境有关的方式来格式化和解析日期的具体类.它允许进行格式化(日期 -> 文本).解析(文本 -> 日期)和规范化. SimpleDateFor ...
 
随机推荐
- Unity3D_异步加载场景(进度条)
			
创建两个场景:现在的场景“NowScene”,要加载的场景“LoadScene”: “NowScene”如图所示,“LoadScene”任意: 创建脚本“AsyncLoadScene”,复制如下代码, ...
 - MySql数据库 - 5.用C#连接数据库
			
添加 dll 引用,dll 位置:C:\Program Files (x86)\MySQL\Connector NET 8.0\Assemblies\v4.5.2 引入命名空间:MySql.Data. ...
 - CH Round #59 - OrzCC杯NOIP模拟赛day1
			
第一题:队爷的新书 题意简述:给定n个闭区间,求出一个数p使它与包含它的区间数的积最大,输出这个积. 分析:使用一个差分数组g,每个区间[l,r],l位置加1,r+1的位置减1,从前往后统计,得到对于 ...
 - 【距离GDOI:137天】  扩展KMP...字符串QAQ
			
上次和黄神两人一合计,干脆我学字符串他学图论,然后两人相互教...但以蒟蒻最近这状态来看,估计会到时候也教不了QAQ 扩展KMP大概是下面这个课件讲的这样 http://wenku.baidu.com ...
 - Android jni 编程入门
			
本文将介绍如何使用eclipse和ndk-build来编写一个基于Android4.4版本的包含有.so动态库的安卓程序. 前提是已经安装和配置好了诸如SDK,NDK等编译环境.下面开始编程! 1 程 ...
 - URAL1960 Palindromes and Super Abilities
			
After solving seven problems on Timus Online Judge with a word “palindrome” in the problem name, Mis ...
 - MongoDB如何使用“”用户名和密码“”
			
在去年的 DB 勒索事件之后, 不少的同学开始加强 Mongodb 的安全性, 其中一种办法就是设置复杂的密码. 那么问题来了, 如果设置的密码里包含一些如 “@”, “:” 一样的特殊字符怎么办? ...
 - 关于apache 虚拟主机配置访问403的问题
			
<Directory /> Options FollowSymLinks Order allow,deny Allow from all</Directory&g ...
 - uva 1611:Crane(构造 Grade D)
			
题目链接 题意: 一个序列,你可以选择其中偶数长度的一段,然后中间切开,左右两段交换.现给你一个1~n的某个排列,求一个交换方案,使得排列最终有序.(交换次数 < 9^6) 思路: 从左到右,依 ...
 - 网络编程socket-SocketServer-FTP
			
16章 网络编程?应该是讲网络之间如何编程来进行通信的章节 16.1.1 客户端/服务器架构?客户端请求访问,服务器端监听请求,处理请求,进行相应的模式16.1.2 客户端/服务器编程?服务器端:创建 ...