⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 biginteger.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Thu Apr 27 23:35:28 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class  BigInteger</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/BigInteger.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup>&nbsp;2&nbsp;Platform<br>Std.&nbsp;Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../java/math/BigDecimal.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;NEXT CLASS</FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="BigInteger.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: &nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">java.math</FONT><BR>Class  BigInteger</H2><PRE><A HREF="../../java/lang/Object.html">java.lang.Object</A>  |  +--<A HREF="../../java/lang/Number.html">java.lang.Number</A>        |        +--<B>java.math.BigInteger</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../java/lang/Comparable.html">Comparable</A>, <A HREF="../../java/io/Serializable.html">Serializable</A></DD></DL><HR><DL><DT>public class <B>BigInteger</B><DT>extends <A HREF="../../java/lang/Number.html">Number</A><DT>implements <A HREF="../../java/lang/Comparable.html">Comparable</A></DL><P>Immutable arbitrary-precision integers.  All operations behave as if BigIntegers were represented in two's-complement notation (like Java's primitive integer types).  BigInteger provides analogues to all of Java's primitive integer operators, and all relevant methods from java.lang.Math. Additionally, BigInteger provides operations for modular arithmetic, GCD calculation, primality testing, prime generation, bit manipulation, and a few other miscellaneous operations. <p> Semantics of arithmetic operations exactly mimic those of Java's integer arithmetic operators, as defined in <i>The Java Language Specification</i>. For example, division by zero throws an <tt>ArithmeticException</tt>, and division of a negative by a positive yields a negative (or zero) remainder. All of the details in the Spec concerning overflow are ignored, as BigIntegers are made as large as necessary to accommodate the results of an operation. <p> Semantics of shift operations extend those of Java's shift operators to allow for negative shift distances.  A right-shift with a negative shift distance results in a left shift, and vice-versa.  The unsigned right shift operator (&gt;&gt;&gt;) is omitted, as this operation makes little sense in combination with the "infinite word size" abstraction provided by this class. <p> Semantics of bitwise logical operations exactly mimic those of Java's bitwise integer operators.  The binary operators (<tt>and</tt>, <tt>or</tt>, <tt>xor</tt>) implicitly perform sign extension on the shorter of the two operands prior to performing the operation. <p> Comparison operations perform signed integer comparisons, analogous to those performed by Java's relational and equality operators. <p> Modular arithmetic operations are provided to compute residues, perform exponentiation, and compute multiplicative inverses.  These methods always return a non-negative result, between <tt>0</tt> and <tt>(modulus - 1)</tt>, inclusive. <p> Bit operations operate on a single bit of the two's-complement representation of their operand.  If necessary, the operand is sign- extended so that it contains the designated bit.  None of the single-bit operations can produce a BigInteger with a different sign from the BigInteger being operated on, as they affect only a single bit, and the "infinite word size" abstraction provided by this class ensures that there are infinitely many "virtual sign bits" preceding each BigInteger. <p> For the sake of brevity and clarity, pseudo-code is used throughout the descriptions of BigInteger methods.  The pseudo-code expression <tt>(i + j)</tt> is shorthand for "a BigInteger whose value is that of the BigInteger <tt>i</tt> plus that of the BigInteger <tt>j</tt>." The pseudo-code expression <tt>(i == j)</tt> is shorthand for "<tt>true</tt> if and only if the BigInteger <tt>i</tt> represents the same value as the the BigInteger <tt>j</tt>."  Other pseudo-code expressions are interpreted similarly.<P><DL><DT><B>Since: </B><DD>JDK1.1</DD><DT><B>See Also: </B><DD><A HREF="../../java/math/BigDecimal.html"><CODE>BigDecimal</CODE></A>, <A HREF="../../serialized-form.html#java.math.BigInteger">Serialized Form</A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;<A HREF="../../java/math/BigInteger.html">BigInteger</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/math/BigInteger.html#ONE">ONE</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The BigInteger constant one.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;<A HREF="../../java/math/BigInteger.html">BigInteger</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/math/BigInteger.html#ZERO">ZERO</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The BigInteger constant zero.</TD></TR></TABLE>&nbsp;<!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/math/BigInteger.html#BigInteger(byte[])">BigInteger</A></B>(byte[]&nbsp;val)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Translates a byte array containing the two's-complement binary representation of a BigInteger into a BigInteger.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/math/BigInteger.html#BigInteger(int, byte[])">BigInteger</A></B>(int&nbsp;signum,           byte[]&nbsp;magnitude)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Translates the sign-magnitude representation of a BigInteger into a BigInteger.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/math/BigInteger.html#BigInteger(int, int, java.util.Random)">BigInteger</A></B>(int&nbsp;bitLength,           int&nbsp;certainty,           <A HREF="../../java/util/Random.html">Random</A>&nbsp;rnd)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a randomly generated positive BigInteger that is probably prime, with the specified bitLength.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/math/BigInteger.html#BigInteger(int, java.util.Random)">BigInteger</A></B>(int&nbsp;numBits,           <A HREF="../../java/util/Random.html">Random</A>&nbsp;rnd)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a randomly generated BigInteger, uniformly distributed over the range <tt>0</tt> to <tt>(2<sup>numBits</sup> - 1)</tt>, inclusive.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/math/BigInteger.html#BigInteger(java.lang.String)">BigInteger</A></B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;val)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Translates the decimal String representation of a BigInteger into a BigInteger.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/math/BigInteger.html#BigInteger(java.lang.String, int)">BigInteger</A></B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;val,           int&nbsp;radix)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Translates the String representation of a BigInteger in the specified radix into a BigInteger.</TD></TR></TABLE>&nbsp;<!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../java/math/BigInteger.html">BigInteger</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/math/BigInteger.html#abs()">abs</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a BigInteger whose value is the absolute value of this BigInteger.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../java/math/BigInteger.html">BigInteger</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/math/BigInteger.html#add(java.math.BigInteger)">add</A></B>(<A HREF="../../java/math/BigInteger.html">BigInteger</A>&nbsp;val)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a BigInteger whose value is <tt>(this + val)</tt>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../java/math/BigInteger.html">BigInteger</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/math/BigInteger.html#and(java.math.BigInteger)">and</A></B>(<A HREF="../../java/math/BigInteger.html">BigInteger</A>&nbsp;val)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a BigInteger whose value is <tt>(this &amp; val)</tt>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../java/math/BigInteger.html">BigInteger</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/math/BigInteger.html#andNot(java.math.BigInteger)">andNot</A></B>(<A HREF="../../java/math/BigInteger.html">BigInteger</A>&nbsp;val)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a BigInteger whose value is <tt>(this &amp; ~val)</tt>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/math/BigInteger.html#bitCount()">bitCount</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the number of bits in the two's complement representation of this BigInteger that differ from its sign bit.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/math/BigInteger.html#bitLength()">bitLength</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the number of bits in the minimal two's-complement representation of this BigInteger, <i>excluding</i> a sign bit.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../java/math/BigInteger.html">BigInteger</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/math/BigInteger.html#clearBit(int)">clearBit</A></B>(int&nbsp;n)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a BigInteger whose value is equivalent to this BigInteger with the designated bit cleared.</TD></TR>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -