📄 biginteger.html
字号:
<DD>Returns a BigInteger whose value is equivalent to this BigInteger with the designated bit cleared. (Computes <tt>(this & ~(1<<n))</tt>.)<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>n</CODE> - index of bit to clear.<DT><B>Returns:</B><DD><tt>this & ~(1<<n)</tt><DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ArithmeticException.html">ArithmeticException</A></CODE> - <tt>n</tt> is negative.</DL></DD></DL><HR><A NAME="flipBit(int)"><!-- --></A><H3>flipBit</H3><PRE>public <A HREF="../../java/math/BigInteger.html">BigInteger</A> <B>flipBit</B>(int n)</PRE><DL><DD>Returns a BigInteger whose value is equivalent to this BigInteger with the designated bit flipped. (Computes <tt>(this ^ (1<<n))</tt>.)<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>n</CODE> - index of bit to flip.<DT><B>Returns:</B><DD><tt>this ^ (1<<n)</tt><DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ArithmeticException.html">ArithmeticException</A></CODE> - <tt>n</tt> is negative.</DL></DD></DL><HR><A NAME="getLowestSetBit()"><!-- --></A><H3>getLowestSetBit</H3><PRE>public int <B>getLowestSetBit</B>()</PRE><DL><DD>Returns the index of the rightmost (lowest-order) one bit in this BigInteger (the number of zero bits to the right of the rightmost one bit). Returns -1 if this BigInteger contains no one bits. (Computes <tt>(this==0? -1 : log<sub>2</sub>(this & -this))</tt>.)<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>index of the rightmost one bit in this BigInteger.</DL></DD></DL><HR><A NAME="bitLength()"><!-- --></A><H3>bitLength</H3><PRE>public int <B>bitLength</B>()</PRE><DL><DD>Returns the number of bits in the minimal two's-complement representation of this BigInteger, <i>excluding</i> a sign bit. For positive BigIntegers, this is equivalent to the number of bits in the ordinary binary representation. (Computes <tt>(ceil(log<sub>2</sub>(this < 0 ? -this : this+1)))</tt>.)<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>number of bits in the minimal two's-complement representation of this BigInteger, <i>excluding</i> a sign bit.</DL></DD></DL><HR><A NAME="bitCount()"><!-- --></A><H3>bitCount</H3><PRE>public int <B>bitCount</B>()</PRE><DL><DD>Returns the number of bits in the two's complement representation of this BigInteger that differ from its sign bit. This method is useful when implementing bit-vector style sets atop BigIntegers.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>number of bits in the two's complement representation of this BigInteger that differ from its sign bit.</DL></DD></DL><HR><A NAME="isProbablePrime(int)"><!-- --></A><H3>isProbablePrime</H3><PRE>public boolean <B>isProbablePrime</B>(int certainty)</PRE><DL><DD>Returns <tt>true</tt> if this BigInteger is probably prime, <tt>false</tt> if it's definitely composite.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>certainty</CODE> - a measure of the uncertainty that the caller is willing to tolerate: if the call returns <tt>true</tt> the probability that this BigInteger is prime exceeds <tt>(1 - 1/2<sup>certainty</sup>)</tt>. The execution time of this method is proportional to the value of this parameter.<DT><B>Returns:</B><DD><tt>true</tt> if this BigInteger is probably prime, <tt>false</tt> if it's definitely composite.</DL></DD></DL><HR><A NAME="compareTo(java.math.BigInteger)"><!-- --></A><H3>compareTo</H3><PRE>public int <B>compareTo</B>(<A HREF="../../java/math/BigInteger.html">BigInteger</A> val)</PRE><DL><DD>Compares this BigInteger with the specified BigInteger. This method is provided in preference to individual methods for each of the six boolean comparison operators (<, ==, >, >=, !=, <=). The suggested idiom for performing these comparisons is: <tt>(x.compareTo(y)</tt> <<i>op</i>> <tt>0)</tt>, where <<i>op</i>> is one of the six comparison operators.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>val</CODE> - BigInteger to which this BigInteger is to be compared.<DT><B>Returns:</B><DD>-1, 0 or 1 as this BigInteger is numerically less than, equal to, or greater than <tt>val</tt>.</DL></DD></DL><HR><A NAME="compareTo(java.lang.Object)"><!-- --></A><H3>compareTo</H3><PRE>public int <B>compareTo</B>(<A HREF="../../java/lang/Object.html">Object</A> o)</PRE><DL><DD>Compares this BigInteger with the specified Object. If the Object is a BigInteger, this method behaves like <tt>compareTo(BigInteger)</tt>. Otherwise, it throws a <tt>ClassCastException</tt> (as BigIntegers are comparable only to other BigIntegers).<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/lang/Comparable.html#compareTo(java.lang.Object)">compareTo</A></CODE> in interface <CODE><A HREF="../../java/lang/Comparable.html">Comparable</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>o</CODE> - Object to which this BigInteger is to be compared.<DT><B>Returns:</B><DD>a negative number, zero, or a positive number as this BigInteger is numerically less than, equal to, or greater than <tt>o</tt>, which must be a BigInteger.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - <tt>o</tt> is not a BigInteger.<DT><B>Since: </B><DD>1.2</DD><DT><B>See Also: </B><DD><A HREF="../../java/math/BigInteger.html#compareTo(java.math.BigInteger)"><CODE>compareTo(java.math.BigInteger)</CODE></A>, <A HREF="../../java/lang/Comparable.html"><CODE>Comparable</CODE></A></DL></DD></DL><HR><A NAME="equals(java.lang.Object)"><!-- --></A><H3>equals</H3><PRE>public boolean <B>equals</B>(<A HREF="../../java/lang/Object.html">Object</A> x)</PRE><DL><DD>Compares this BigInteger with the specified Object for equality.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html">Object</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>x</CODE> - Object to which this BigInteger is to be compared.<DT><B>Returns:</B><DD><tt>true</tt> if and only if the specified Object is a BigInteger whose value is numerically equal to this BigInteger.</DL></DD></DL><HR><A NAME="min(java.math.BigInteger)"><!-- --></A><H3>min</H3><PRE>public <A HREF="../../java/math/BigInteger.html">BigInteger</A> <B>min</B>(<A HREF="../../java/math/BigInteger.html">BigInteger</A> val)</PRE><DL><DD>Returns the minimum of this BigInteger and <tt>val</tt>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>val</CODE> - value with with the minimum is to be computed.<DT><B>Returns:</B><DD>the BigInteger whose value is the lesser of this BigInteger and <tt>val</tt>. If they are equal, either may be returned.</DL></DD></DL><HR><A NAME="max(java.math.BigInteger)"><!-- --></A><H3>max</H3><PRE>public <A HREF="../../java/math/BigInteger.html">BigInteger</A> <B>max</B>(<A HREF="../../java/math/BigInteger.html">BigInteger</A> val)</PRE><DL><DD>Returns the maximum of this BigInteger and <tt>val</tt>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>val</CODE> - value with with the maximum is to be computed.<DT><B>Returns:</B><DD>the BigInteger whose value is the greater of this and <tt>val</tt>. If they are equal, either may be returned.</DL></DD></DL><HR><A NAME="hashCode()"><!-- --></A><H3>hashCode</H3><PRE>public int <B>hashCode</B>()</PRE><DL><DD>Returns the hash code for this BigInteger.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#hashCode()">hashCode</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html">Object</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>hash code for this BigInteger.</DL></DD></DL><HR><A NAME="toString(int)"><!-- --></A><H3>toString</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>toString</B>(int radix)</PRE><DL><DD>Returns the String representation of this BigInteger in the given radix. If the radix is outside the range from <tt>Character.MIN_RADIX</tt> (2) to <tt>Character.MAX_RADIX</tt> (36) inclusive, it will default to 10 (as is the case for <tt>Integer.toString</tt>). The digit-to-character mapping provided by <tt>Character.forDigit</tt> is used, and a minus sign is prepended if appropriate. (This representation is compatible with the (String, int) constructor.)<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>radix</CODE> - radix of the String representation.<DT><B>Returns:</B><DD>String representation of this BigInteger in the given radix.<DT><B>See Also: </B><DD><A HREF="../../java/lang/Integer.html#toString(int, int)"><CODE>Integer.toString(int, int)</CODE></A>, <A HREF="../../java/lang/Character.html#forDigit(int, int)"><CODE>Character.forDigit(int, int)</CODE></A>, <A HREF="../../java/math/BigInteger.html#BigInteger(java.lang.String, int)"><CODE>BigInteger(java.lang.String, int)</CODE></A></DL></DD></DL><HR><A NAME="toString()"><!-- --></A><H3>toString</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>toString</B>()</PRE><DL><DD>Returns the decimal String representation of this BigInteger. The digit-to-character mapping provided by <tt>Character.forDigit</tt> is used, and a minus sign is prepended if appropriate. (This representation is compatible with the (String) constructor, and allows for String concatenation with Java's + operator.)<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#toString()">toString</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html">Object</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>decimal String representation of this BigInteger.<DT><B>See Also: </B><DD><A HREF="../../java/lang/Character.html#forDigit(int, int)"><CODE>Character.forDigit(int, int)</CODE></A>, <A HREF="../../java/math/BigInteger.html#BigInteger(java.lang.String)"><CODE>BigInteger(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="toByteArray()"><!-- --></A><H3>toByteArray</H3><PRE>public byte[] <B>toByteArray</B>()</PRE><DL><DD>Returns a byte array containing the two's-complement representation of this BigInteger. The byte array will be in <i>big-endian</i> byte-order: the most significant byte is in the zeroth element. The array will contain the minimum number of bytes required to represent this BigInteger, including at least one sign bit, which is <tt>(ceil((this.bitLength() + 1)/8))</tt>. (This representation is compatible with the (byte[]) constructor.)<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>a byte array containing the two's-complement representation of this BigInteger.<DT><B>See Also: </B><DD><A HREF="../../java/math/BigInteger.html#BigInteger(byte[])"><CODE>BigInteger(byte[])</CODE></A></DL></DD></DL><HR><A NAME="intValue()"><!-- --></A><H3>intValue</H3><PRE>public int <B>intValue</B>()</PRE><DL><DD>Converts this BigInteger to an int. Standard <i>narrowing primitive conversion</i> as defined in <i>The Java Language Specification</i>: if this BigInteger is too big to fit in an int, only the low-order 32 bits are returned.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Number.html#intValue()">intValue</A></CODE> in class <CODE><A HREF="../../java/lang/Number.html">Number</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>this BigInteger converted to an int.</DL></DD></DL><HR><A NAME="longValue()"><!-- --></A><H3>longValue</H3><PRE>public long <B>longValue</B>()</PRE><DL><DD>Converts this BigInteger to a long. Standard <i>narrowing primitive conversion</i> as d
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -