< prev index next >
src/java.base/share/classes/java/math/BigInteger.java
Print this page
@@ -114,21 +114,22 @@
* the result is out of the supported range of
* -2<sup>{@code Integer.MAX_VALUE}</sup> (exclusive) to
* +2<sup>{@code Integer.MAX_VALUE}</sup> (exclusive).
*
* @see BigDecimal
+ * @jls 4.2.2 Integer Operations
* @author Josh Bloch
* @author Michael McCloskey
* @author Alan Eliasen
* @author Timothy Buktu
* @since 1.1
*/
public class BigInteger extends Number implements Comparable<BigInteger> {
/**
* The signum of this BigInteger: -1 for negative, 0 for zero, or
- * 1 for positive. Note that the BigInteger zero <i>must</i> have
+ * 1 for positive. Note that the BigInteger zero <em>must</em> have
* a signum of 0. This is necessary to ensures that there is exactly one
* representation for each BigInteger value.
*/
final int signum;
@@ -708,11 +709,11 @@
/**
* Constructs a randomly generated positive BigInteger that is probably
* prime, with the specified bitLength.
*
- * <p>It is recommended that the {@link #probablePrime probablePrime}
+ * @apiNote It is recommended that the {@link #probablePrime probablePrime}
* method be used in preference to this constructor unless there
* is a compelling need to specify a certainty.
*
* @param bitLength bitLength of the returned BigInteger.
* @param certainty a measure of the uncertainty that the caller is
@@ -1155,13 +1156,15 @@
//Static Factory Methods
/**
* Returns a BigInteger whose value is equal to that of the
- * specified {@code long}. This "static factory method" is
- * provided in preference to a ({@code long}) constructor
- * because it allows for reuse of frequently used BigIntegers.
+ * specified {@code long}.
+ *
+ * @apiNote This static factory method is provided in preference
+ * to a ({@code long}) constructor because it allows for reuse of
+ * frequently used BigIntegers.
*
* @param val value of the BigInteger to return.
* @return a BigInteger with the specified value.
*/
public static BigInteger valueOf(long val) {
@@ -3549,17 +3552,17 @@
// Miscellaneous Bit Operations
/**
* Returns the number of bits in the minimal two's-complement
- * representation of this BigInteger, <i>excluding</i> a sign bit.
+ * representation of this BigInteger, <em>excluding</em> a sign bit.
* For positive BigIntegers, this is equivalent to the number of bits in
* the ordinary binary representation. (Computes
* {@code (ceil(log2(this < 0 ? -this : this+1)))}.)
*
* @return number of bits in the minimal two's-complement
- * representation of this BigInteger, <i>excluding</i> a sign bit.
+ * representation of this BigInteger, <em>excluding</em> a sign bit.
*/
public int bitLength() {
int n = bitLengthPlusOne - 1;
if (n == -1) { // bitLength not initialized yet
int[] m = mag;
@@ -4032,20 +4035,21 @@
/**
* Converts this BigInteger to an {@code int}. This
* conversion is analogous to a
* <i>narrowing primitive conversion</i> from {@code long} to
- * {@code int} as defined in section 5.1.3 of
+ * {@code int} as defined in
* <cite>The Java™ Language Specification</cite>:
* if this BigInteger is too big to fit in an
* {@code int}, only the low-order 32 bits are returned.
* Note that this conversion can lose information about the
* overall magnitude of the BigInteger value as well as return a
* result with the opposite sign.
*
* @return this BigInteger converted to an {@code int}.
* @see #intValueExact()
+ * @jls 5.1.3 Narrowing Primitive Conversion
*/
public int intValue() {
int result = 0;
result = getInt(0);
return result;
@@ -4053,20 +4057,21 @@
/**
* Converts this BigInteger to a {@code long}. This
* conversion is analogous to a
* <i>narrowing primitive conversion</i> from {@code long} to
- * {@code int} as defined in section 5.1.3 of
+ * {@code int} as defined in
* <cite>The Java™ Language Specification</cite>:
* if this BigInteger is too big to fit in a
* {@code long}, only the low-order 64 bits are returned.
* Note that this conversion can lose information about the
* overall magnitude of the BigInteger value as well as return a
* result with the opposite sign.
*
* @return this BigInteger converted to a {@code long}.
* @see #longValueExact()
+ * @jls 5.1.3 Narrowing Primitive Conversion
*/
public long longValue() {
long result = 0;
for (int i=1; i >= 0; i--)
@@ -4076,20 +4081,21 @@
/**
* Converts this BigInteger to a {@code float}. This
* conversion is similar to the
* <i>narrowing primitive conversion</i> from {@code double} to
- * {@code float} as defined in section 5.1.3 of
+ * {@code float} as defined in
* <cite>The Java™ Language Specification</cite>:
* if this BigInteger has too great a magnitude
* to represent as a {@code float}, it will be converted to
* {@link Float#NEGATIVE_INFINITY} or {@link
* Float#POSITIVE_INFINITY} as appropriate. Note that even when
* the return value is finite, this conversion can lose
* information about the precision of the BigInteger value.
*
* @return this BigInteger converted to a {@code float}.
+ * @jls 5.1.3 Narrowing Primitive Conversion
*/
public float floatValue() {
if (signum == 0) {
return 0.0f;
}
@@ -4160,20 +4166,21 @@
/**
* Converts this BigInteger to a {@code double}. This
* conversion is similar to the
* <i>narrowing primitive conversion</i> from {@code double} to
- * {@code float} as defined in section 5.1.3 of
+ * {@code float} as defined in
* <cite>The Java™ Language Specification</cite>:
* if this BigInteger has too great a magnitude
* to represent as a {@code double}, it will be converted to
* {@link Double#NEGATIVE_INFINITY} or {@link
* Double#POSITIVE_INFINITY} as appropriate. Note that even when
* the return value is finite, this conversion can lose
* information about the precision of the BigInteger value.
*
* @return this BigInteger converted to a {@code double}.
+ * @jls 5.1.3 Narrowing Primitive Conversion
*/
public double doubleValue() {
if (signum == 0) {
return 0.0;
}
< prev index next >