8157724: Improve javadoc tag usage in java.math
Reviewed-by: bpb
This commit is contained in:
parent
af7a591d39
commit
072a878dbb
@ -55,7 +55,7 @@ import java.util.Arrays;
|
|||||||
* object to the operation. In either case, eight <em>rounding
|
* object to the operation. In either case, eight <em>rounding
|
||||||
* modes</em> are provided for the control of rounding. Using the
|
* modes</em> are provided for the control of rounding. Using the
|
||||||
* integer fields in this class (such as {@link #ROUND_HALF_UP}) to
|
* integer fields in this class (such as {@link #ROUND_HALF_UP}) to
|
||||||
* represent rounding mode is largely obsolete; the enumeration values
|
* represent rounding mode is deprecated; the enumeration values
|
||||||
* of the {@code RoundingMode} {@code enum}, (such as {@link
|
* of the {@code RoundingMode} {@code enum}, (such as {@link
|
||||||
* RoundingMode#HALF_UP}) should be used instead.
|
* RoundingMode#HALF_UP}) should be used instead.
|
||||||
*
|
*
|
||||||
@ -93,7 +93,7 @@ import java.util.Arrays;
|
|||||||
* <p>In general the rounding modes and precision setting determine
|
* <p>In general the rounding modes and precision setting determine
|
||||||
* how operations return results with a limited number of digits when
|
* how operations return results with a limited number of digits when
|
||||||
* the exact result has more digits (perhaps infinitely many in the
|
* the exact result has more digits (perhaps infinitely many in the
|
||||||
* case of division) than the number of digits returned.
|
* case of division and square root) than the number of digits returned.
|
||||||
*
|
*
|
||||||
* First, the
|
* First, the
|
||||||
* total number of digits to return is specified by the
|
* total number of digits to return is specified by the
|
||||||
@ -196,18 +196,19 @@ import java.util.Arrays;
|
|||||||
* {@code BigDecimal} value; for example [19, 2] is the
|
* {@code BigDecimal} value; for example [19, 2] is the
|
||||||
* {@code BigDecimal} numerically equal to 0.19 having a scale of 2.
|
* {@code BigDecimal} numerically equal to 0.19 having a scale of 2.
|
||||||
*
|
*
|
||||||
* <p>Note: care should be exercised if {@code BigDecimal} objects
|
|
||||||
* are used as keys in a {@link java.util.SortedMap SortedMap} or
|
|
||||||
* elements in a {@link java.util.SortedSet SortedSet} since
|
|
||||||
* {@code BigDecimal}'s <i>natural ordering</i> is <i>inconsistent
|
|
||||||
* with equals</i>. See {@link Comparable}, {@link
|
|
||||||
* java.util.SortedMap} or {@link java.util.SortedSet} for more
|
|
||||||
* information.
|
|
||||||
*
|
*
|
||||||
* <p>All methods and constructors for this class throw
|
* <p>All methods and constructors for this class throw
|
||||||
* {@code NullPointerException} when passed a {@code null} object
|
* {@code NullPointerException} when passed a {@code null} object
|
||||||
* reference for any input parameter.
|
* reference for any input parameter.
|
||||||
*
|
*
|
||||||
|
* @apiNote Care should be exercised if {@code BigDecimal} objects
|
||||||
|
* are used as keys in a {@link java.util.SortedMap SortedMap} or
|
||||||
|
* elements in a {@link java.util.SortedSet SortedSet} since
|
||||||
|
* {@code BigDecimal}'s <i>natural ordering</i> is <em>inconsistent
|
||||||
|
* with equals</em>. See {@link Comparable}, {@link
|
||||||
|
* java.util.SortedMap} or {@link java.util.SortedSet} for more
|
||||||
|
* information.
|
||||||
|
*
|
||||||
* @see BigInteger
|
* @see BigInteger
|
||||||
* @see MathContext
|
* @see MathContext
|
||||||
* @see RoundingMode
|
* @see RoundingMode
|
||||||
@ -377,10 +378,10 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||||||
* same sequence of characters as the {@link #BigDecimal(String)}
|
* same sequence of characters as the {@link #BigDecimal(String)}
|
||||||
* constructor, while allowing a sub-array to be specified.
|
* constructor, while allowing a sub-array to be specified.
|
||||||
*
|
*
|
||||||
* <p>Note that if the sequence of characters is already available
|
* @implNote If the sequence of characters is already available
|
||||||
* within a character array, using this constructor is faster than
|
* within a character array, using this constructor is faster than
|
||||||
* converting the {@code char} array to string and using the
|
* converting the {@code char} array to string and using the
|
||||||
* {@code BigDecimal(String)} constructor .
|
* {@code BigDecimal(String)} constructor.
|
||||||
*
|
*
|
||||||
* @param in {@code char} array that is the source of characters.
|
* @param in {@code char} array that is the source of characters.
|
||||||
* @param offset first character in the array to inspect.
|
* @param offset first character in the array to inspect.
|
||||||
@ -401,14 +402,14 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||||||
* constructor, while allowing a sub-array to be specified and
|
* constructor, while allowing a sub-array to be specified and
|
||||||
* with rounding according to the context settings.
|
* with rounding according to the context settings.
|
||||||
*
|
*
|
||||||
* <p>Note that if the sequence of characters is already available
|
* @implNote If the sequence of characters is already available
|
||||||
* within a character array, using this constructor is faster than
|
* within a character array, using this constructor is faster than
|
||||||
* converting the {@code char} array to string and using the
|
* converting the {@code char} array to string and using the
|
||||||
* {@code BigDecimal(String)} constructor.
|
* {@code BigDecimal(String)} constructor.
|
||||||
*
|
*
|
||||||
* @param in {@code char} array that is the source of characters.
|
* @param in {@code char} array that is the source of characters.
|
||||||
* @param offset first character in the array to inspect.
|
* @param offset first character in the array to inspect.
|
||||||
* @param len number of characters to consider..
|
* @param len number of characters to consider.
|
||||||
* @param mc the context to use.
|
* @param mc the context to use.
|
||||||
* @throws ArithmeticException if the result is inexact but the
|
* @throws ArithmeticException if the result is inexact but the
|
||||||
* rounding mode is {@code UNNECESSARY}.
|
* rounding mode is {@code UNNECESSARY}.
|
||||||
@ -679,10 +680,10 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||||||
* same sequence of characters as the {@link #BigDecimal(String)}
|
* same sequence of characters as the {@link #BigDecimal(String)}
|
||||||
* constructor.
|
* constructor.
|
||||||
*
|
*
|
||||||
* <p>Note that if the sequence of characters is already available
|
* @implNote If the sequence of characters is already available
|
||||||
* as a character array, using this constructor is faster than
|
* as a character array, using this constructor is faster than
|
||||||
* converting the {@code char} array to string and using the
|
* converting the {@code char} array to string and using the
|
||||||
* {@code BigDecimal(String)} constructor .
|
* {@code BigDecimal(String)} constructor.
|
||||||
*
|
*
|
||||||
* @param in {@code char} array that is the source of characters.
|
* @param in {@code char} array that is the source of characters.
|
||||||
* @throws NumberFormatException if {@code in} is not a valid
|
* @throws NumberFormatException if {@code in} is not a valid
|
||||||
@ -700,10 +701,10 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||||||
* constructor and with rounding according to the context
|
* constructor and with rounding according to the context
|
||||||
* settings.
|
* settings.
|
||||||
*
|
*
|
||||||
* <p>Note that if the sequence of characters is already available
|
* @implNote If the sequence of characters is already available
|
||||||
* as a character array, using this constructor is faster than
|
* as a character array, using this constructor is faster than
|
||||||
* converting the {@code char} array to string and using the
|
* converting the {@code char} array to string and using the
|
||||||
* {@code BigDecimal(String)} constructor .
|
* {@code BigDecimal(String)} constructor.
|
||||||
*
|
*
|
||||||
* @param in {@code char} array that is the source of characters.
|
* @param in {@code char} array that is the source of characters.
|
||||||
* @param mc the context to use.
|
* @param mc the context to use.
|
||||||
@ -805,7 +806,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||||||
* "-0" [0,0]
|
* "-0" [0,0]
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* <p>Note: For values other than {@code float} and
|
* @apiNote For values other than {@code float} and
|
||||||
* {@code double} NaN and ±Infinity, this constructor is
|
* {@code double} NaN and ±Infinity, this constructor is
|
||||||
* compatible with the values returned by {@link Float#toString}
|
* compatible with the values returned by {@link Float#toString}
|
||||||
* and {@link Double#toString}. This is generally the preferred
|
* and {@link Double#toString}. This is generally the preferred
|
||||||
@ -859,13 +860,13 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||||||
* This is because 0.1 cannot be represented exactly as a
|
* This is because 0.1 cannot be represented exactly as a
|
||||||
* {@code double} (or, for that matter, as a binary fraction of
|
* {@code double} (or, for that matter, as a binary fraction of
|
||||||
* any finite length). Thus, the value that is being passed
|
* any finite length). Thus, the value that is being passed
|
||||||
* <i>in</i> to the constructor is not exactly equal to 0.1,
|
* <em>in</em> to the constructor is not exactly equal to 0.1,
|
||||||
* appearances notwithstanding.
|
* appearances notwithstanding.
|
||||||
*
|
*
|
||||||
* <li>
|
* <li>
|
||||||
* The {@code String} constructor, on the other hand, is
|
* The {@code String} constructor, on the other hand, is
|
||||||
* perfectly predictable: writing {@code new BigDecimal("0.1")}
|
* perfectly predictable: writing {@code new BigDecimal("0.1")}
|
||||||
* creates a {@code BigDecimal} which is <i>exactly</i> equal to
|
* creates a {@code BigDecimal} which is <em>exactly</em> equal to
|
||||||
* 0.1, as one would expect. Therefore, it is generally
|
* 0.1, as one would expect. Therefore, it is generally
|
||||||
* recommended that the {@linkplain #BigDecimal(String)
|
* recommended that the {@linkplain #BigDecimal(String)
|
||||||
* String constructor} be used in preference to this one.
|
* String constructor} be used in preference to this one.
|
||||||
@ -1199,10 +1200,11 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Translates a {@code long} unscaled value and an
|
* Translates a {@code long} unscaled value and an
|
||||||
* {@code int} scale into a {@code BigDecimal}. This
|
* {@code int} scale into a {@code BigDecimal}.
|
||||||
* {@literal "static factory method"} is provided in preference to
|
*
|
||||||
* a ({@code long}, {@code int}) constructor because it
|
* @apiNote This static factory method is provided in preference
|
||||||
* allows for reuse of frequently used {@code BigDecimal} values..
|
* to a ({@code long}, {@code int}) constructor because it allows
|
||||||
|
* for reuse of frequently used {@code BigDecimal} values.
|
||||||
*
|
*
|
||||||
* @param unscaledVal unscaled value of the {@code BigDecimal}.
|
* @param unscaledVal unscaled value of the {@code BigDecimal}.
|
||||||
* @param scale scale of the {@code BigDecimal}.
|
* @param scale scale of the {@code BigDecimal}.
|
||||||
@ -1222,10 +1224,11 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Translates a {@code long} value into a {@code BigDecimal}
|
* Translates a {@code long} value into a {@code BigDecimal}
|
||||||
* with a scale of zero. This {@literal "static factory method"}
|
* with a scale of zero.
|
||||||
* is provided in preference to a ({@code long}) constructor
|
*
|
||||||
* because it allows for reuse of frequently used
|
* @apiNote This static factory method is provided in preference
|
||||||
* {@code BigDecimal} values.
|
* to a ({@code long}) constructor because it allows for reuse of
|
||||||
|
* frequently used {@code BigDecimal} values.
|
||||||
*
|
*
|
||||||
* @param val value of the {@code BigDecimal}.
|
* @param val value of the {@code BigDecimal}.
|
||||||
* @return a {@code BigDecimal} whose value is {@code val}.
|
* @return a {@code BigDecimal} whose value is {@code val}.
|
||||||
@ -1270,11 +1273,11 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||||||
* the {@code double}'s canonical string representation provided
|
* the {@code double}'s canonical string representation provided
|
||||||
* by the {@link Double#toString(double)} method.
|
* by the {@link Double#toString(double)} method.
|
||||||
*
|
*
|
||||||
* <p><b>Note:</b> This is generally the preferred way to convert
|
* @apiNote This is generally the preferred way to convert a
|
||||||
* a {@code double} (or {@code float}) into a
|
* {@code double} (or {@code float}) into a {@code BigDecimal}, as
|
||||||
* {@code BigDecimal}, as the value returned is equal to that
|
* the value returned is equal to that resulting from constructing
|
||||||
* resulting from constructing a {@code BigDecimal} from the
|
* a {@code BigDecimal} from the result of using {@link
|
||||||
* result of using {@link Double#toString(double)}.
|
* Double#toString(double)}.
|
||||||
*
|
*
|
||||||
* @param val {@code double} to convert to a {@code BigDecimal}.
|
* @param val {@code double} to convert to a {@code BigDecimal}.
|
||||||
* @return a {@code BigDecimal} whose value is equal to or approximately
|
* @return a {@code BigDecimal} whose value is equal to or approximately
|
||||||
@ -1896,7 +1899,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||||||
*
|
*
|
||||||
* <p>The remainder is given by
|
* <p>The remainder is given by
|
||||||
* {@code this.subtract(this.divideToIntegralValue(divisor).multiply(divisor))}.
|
* {@code this.subtract(this.divideToIntegralValue(divisor).multiply(divisor))}.
|
||||||
* Note that this is not the modulo operation (the result can be
|
* Note that this is <em>not</em> the modulo operation (the result can be
|
||||||
* negative).
|
* negative).
|
||||||
*
|
*
|
||||||
* @param divisor value by which this {@code BigDecimal} is to be divided.
|
* @param divisor value by which this {@code BigDecimal} is to be divided.
|
||||||
@ -2037,6 +2040,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||||||
* {@code (mc.getRoundingMode()==RoundingMode.UNNECESSARY}) and
|
* {@code (mc.getRoundingMode()==RoundingMode.UNNECESSARY}) and
|
||||||
* the exact result cannot fit in {@code mc.getPrecision()}
|
* the exact result cannot fit in {@code mc.getPrecision()}
|
||||||
* digits.
|
* digits.
|
||||||
|
* @see BigInteger#sqrt()
|
||||||
* @since 9
|
* @since 9
|
||||||
*/
|
*/
|
||||||
public BigDecimal sqrt(MathContext mc) {
|
public BigDecimal sqrt(MathContext mc) {
|
||||||
@ -2694,8 +2698,8 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||||||
* in this case, the specified rounding mode is applied to the
|
* in this case, the specified rounding mode is applied to the
|
||||||
* division.
|
* division.
|
||||||
*
|
*
|
||||||
* <p>Note that since BigDecimal objects are immutable, calls of
|
* @apiNote Since BigDecimal objects are immutable, calls of
|
||||||
* this method do <i>not</i> result in the original object being
|
* this method do <em>not</em> result in the original object being
|
||||||
* modified, contrary to the usual convention of having methods
|
* modified, contrary to the usual convention of having methods
|
||||||
* named <code>set<i>X</i></code> mutate field <i>{@code X}</i>.
|
* named <code>set<i>X</i></code> mutate field <i>{@code X}</i>.
|
||||||
* Instead, {@code setScale} returns an object with the proper
|
* Instead, {@code setScale} returns an object with the proper
|
||||||
@ -2727,8 +2731,8 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||||||
* in this case, the specified rounding mode is applied to the
|
* in this case, the specified rounding mode is applied to the
|
||||||
* division.
|
* division.
|
||||||
*
|
*
|
||||||
* <p>Note that since BigDecimal objects are immutable, calls of
|
* @apiNote Since BigDecimal objects are immutable, calls of
|
||||||
* this method do <i>not</i> result in the original object being
|
* this method do <em>not</em> result in the original object being
|
||||||
* modified, contrary to the usual convention of having methods
|
* modified, contrary to the usual convention of having methods
|
||||||
* named <code>set<i>X</i></code> mutate field <i>{@code X}</i>.
|
* named <code>set<i>X</i></code> mutate field <i>{@code X}</i>.
|
||||||
* Instead, {@code setScale} returns an object with the proper
|
* Instead, {@code setScale} returns an object with the proper
|
||||||
@ -2822,8 +2826,8 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||||||
* versions of {@code setScale}, but saves the caller the trouble
|
* versions of {@code setScale}, but saves the caller the trouble
|
||||||
* of specifying a rounding mode in cases where it is irrelevant.
|
* of specifying a rounding mode in cases where it is irrelevant.
|
||||||
*
|
*
|
||||||
* <p>Note that since {@code BigDecimal} objects are immutable,
|
* @apiNote Since {@code BigDecimal} objects are immutable,
|
||||||
* calls of this method do <i>not</i> result in the original
|
* calls of this method do <em>not</em> result in the original
|
||||||
* object being modified, contrary to the usual convention of
|
* object being modified, contrary to the usual convention of
|
||||||
* having methods named <code>set<i>X</i></code> mutate field
|
* having methods named <code>set<i>X</i></code> mutate field
|
||||||
* <i>{@code X}</i>. Instead, {@code setScale} returns an
|
* <i>{@code X}</i>. Instead, {@code setScale} returns an
|
||||||
@ -3091,7 +3095,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||||||
/**
|
/**
|
||||||
* Returns the hash code for this {@code BigDecimal}. Note that
|
* Returns the hash code for this {@code BigDecimal}. Note that
|
||||||
* two {@code BigDecimal} objects that are numerically equal but
|
* two {@code BigDecimal} objects that are numerically equal but
|
||||||
* differ in scale (like 2.0 and 2.00) will generally <i>not</i>
|
* differ in scale (like 2.0 and 2.00) will generally <em>not</em>
|
||||||
* have the same hash code.
|
* have the same hash code.
|
||||||
*
|
*
|
||||||
* @return hash code for this {@code BigDecimal}.
|
* @return hash code for this {@code BigDecimal}.
|
||||||
@ -3342,7 +3346,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||||||
* Converts this {@code BigDecimal} to a {@code BigInteger}.
|
* Converts this {@code BigDecimal} to a {@code BigInteger}.
|
||||||
* This conversion is analogous to the
|
* This conversion is analogous to the
|
||||||
* <i>narrowing primitive conversion</i> from {@code double} to
|
* <i>narrowing primitive conversion</i> from {@code double} to
|
||||||
* {@code long} as defined in section 5.1.3 of
|
* {@code long} as defined in
|
||||||
* <cite>The Java™ Language Specification</cite>:
|
* <cite>The Java™ Language Specification</cite>:
|
||||||
* any fractional part of this
|
* any fractional part of this
|
||||||
* {@code BigDecimal} will be discarded. Note that this
|
* {@code BigDecimal} will be discarded. Note that this
|
||||||
@ -3354,6 +3358,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||||||
* {@link #toBigIntegerExact()} method.
|
* {@link #toBigIntegerExact()} method.
|
||||||
*
|
*
|
||||||
* @return this {@code BigDecimal} converted to a {@code BigInteger}.
|
* @return this {@code BigDecimal} converted to a {@code BigInteger}.
|
||||||
|
* @jls 5.1.3 Narrowing Primitive Conversion
|
||||||
*/
|
*/
|
||||||
public BigInteger toBigInteger() {
|
public BigInteger toBigInteger() {
|
||||||
// force to an integer, quietly
|
// force to an integer, quietly
|
||||||
@ -3379,7 +3384,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||||||
* Converts this {@code BigDecimal} to a {@code long}.
|
* Converts this {@code BigDecimal} to a {@code long}.
|
||||||
* This conversion is analogous to the
|
* This conversion is analogous to the
|
||||||
* <i>narrowing primitive conversion</i> from {@code double} to
|
* <i>narrowing primitive conversion</i> from {@code double} to
|
||||||
* {@code short} as defined in section 5.1.3 of
|
* {@code short} as defined in
|
||||||
* <cite>The Java™ Language Specification</cite>:
|
* <cite>The Java™ Language Specification</cite>:
|
||||||
* any fractional part of this
|
* any fractional part of this
|
||||||
* {@code BigDecimal} will be discarded, and if the resulting
|
* {@code BigDecimal} will be discarded, and if the resulting
|
||||||
@ -3390,6 +3395,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||||||
* as return a result with the opposite sign.
|
* as return a result with the opposite sign.
|
||||||
*
|
*
|
||||||
* @return this {@code BigDecimal} converted to a {@code long}.
|
* @return this {@code BigDecimal} converted to a {@code long}.
|
||||||
|
* @jls 5.1.3 Narrowing Primitive Conversion
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public long longValue(){
|
public long longValue(){
|
||||||
@ -3448,7 +3454,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||||||
* Converts this {@code BigDecimal} to an {@code int}.
|
* Converts this {@code BigDecimal} to an {@code int}.
|
||||||
* This conversion is analogous to the
|
* This conversion is analogous to the
|
||||||
* <i>narrowing primitive conversion</i> from {@code double} to
|
* <i>narrowing primitive conversion</i> from {@code double} to
|
||||||
* {@code short} as defined in section 5.1.3 of
|
* {@code short} as defined in
|
||||||
* <cite>The Java™ Language Specification</cite>:
|
* <cite>The Java™ Language Specification</cite>:
|
||||||
* any fractional part of this
|
* any fractional part of this
|
||||||
* {@code BigDecimal} will be discarded, and if the resulting
|
* {@code BigDecimal} will be discarded, and if the resulting
|
||||||
@ -3459,6 +3465,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||||||
* value as well as return a result with the opposite sign.
|
* value as well as return a result with the opposite sign.
|
||||||
*
|
*
|
||||||
* @return this {@code BigDecimal} converted to an {@code int}.
|
* @return this {@code BigDecimal} converted to an {@code int}.
|
||||||
|
* @jls 5.1.3 Narrowing Primitive Conversion
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int intValue() {
|
public int intValue() {
|
||||||
@ -3531,7 +3538,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||||||
* Converts this {@code BigDecimal} to a {@code float}.
|
* Converts this {@code BigDecimal} to a {@code float}.
|
||||||
* This conversion is similar to the
|
* This conversion is similar to the
|
||||||
* <i>narrowing primitive conversion</i> from {@code double} to
|
* <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>:
|
* <cite>The Java™ Language Specification</cite>:
|
||||||
* if this {@code BigDecimal} has too great a
|
* if this {@code BigDecimal} has too great a
|
||||||
* magnitude to represent as a {@code float}, it will be
|
* magnitude to represent as a {@code float}, it will be
|
||||||
@ -3542,6 +3549,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||||||
* value.
|
* value.
|
||||||
*
|
*
|
||||||
* @return this {@code BigDecimal} converted to a {@code float}.
|
* @return this {@code BigDecimal} converted to a {@code float}.
|
||||||
|
* @jls 5.1.3 Narrowing Primitive Conversion
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public float floatValue(){
|
public float floatValue(){
|
||||||
@ -3575,7 +3583,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||||||
* Converts this {@code BigDecimal} to a {@code double}.
|
* Converts this {@code BigDecimal} to a {@code double}.
|
||||||
* This conversion is similar to the
|
* This conversion is similar to the
|
||||||
* <i>narrowing primitive conversion</i> from {@code double} to
|
* <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>:
|
* <cite>The Java™ Language Specification</cite>:
|
||||||
* if this {@code BigDecimal} has too great a
|
* if this {@code BigDecimal} has too great a
|
||||||
* magnitude represent as a {@code double}, it will be
|
* magnitude represent as a {@code double}, it will be
|
||||||
@ -3586,6 +3594,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||||||
* value.
|
* value.
|
||||||
*
|
*
|
||||||
* @return this {@code BigDecimal} converted to a {@code double}.
|
* @return this {@code BigDecimal} converted to a {@code double}.
|
||||||
|
* @jls 5.1.3 Narrowing Primitive Conversion
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public double doubleValue(){
|
public double doubleValue(){
|
||||||
|
@ -116,6 +116,7 @@ import jdk.internal.HotSpotIntrinsicCandidate;
|
|||||||
* +2<sup>{@code Integer.MAX_VALUE}</sup> (exclusive).
|
* +2<sup>{@code Integer.MAX_VALUE}</sup> (exclusive).
|
||||||
*
|
*
|
||||||
* @see BigDecimal
|
* @see BigDecimal
|
||||||
|
* @jls 4.2.2 Integer Operations
|
||||||
* @author Josh Bloch
|
* @author Josh Bloch
|
||||||
* @author Michael McCloskey
|
* @author Michael McCloskey
|
||||||
* @author Alan Eliasen
|
* @author Alan Eliasen
|
||||||
@ -126,7 +127,7 @@ import jdk.internal.HotSpotIntrinsicCandidate;
|
|||||||
public class BigInteger extends Number implements Comparable<BigInteger> {
|
public class BigInteger extends Number implements Comparable<BigInteger> {
|
||||||
/**
|
/**
|
||||||
* The signum of this BigInteger: -1 for negative, 0 for zero, or
|
* 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
|
* a signum of 0. This is necessary to ensures that there is exactly one
|
||||||
* representation for each BigInteger value.
|
* representation for each BigInteger value.
|
||||||
*/
|
*/
|
||||||
@ -710,7 +711,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
|
|||||||
* Constructs a randomly generated positive BigInteger that is probably
|
* Constructs a randomly generated positive BigInteger that is probably
|
||||||
* prime, with the specified bitLength.
|
* 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
|
* method be used in preference to this constructor unless there
|
||||||
* is a compelling need to specify a certainty.
|
* is a compelling need to specify a certainty.
|
||||||
*
|
*
|
||||||
@ -1157,9 +1158,11 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a BigInteger whose value is equal to that of the
|
* Returns a BigInteger whose value is equal to that of the
|
||||||
* specified {@code long}. This "static factory method" is
|
* specified {@code long}.
|
||||||
* provided in preference to a ({@code long}) constructor
|
*
|
||||||
* because it allows for reuse of frequently used BigIntegers.
|
* @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.
|
* @param val value of the BigInteger to return.
|
||||||
* @return a BigInteger with the specified value.
|
* @return a BigInteger with the specified value.
|
||||||
@ -3551,13 +3554,13 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of bits in the minimal two's-complement
|
* 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
|
* For positive BigIntegers, this is equivalent to the number of bits in
|
||||||
* the ordinary binary representation. (Computes
|
* the ordinary binary representation. (Computes
|
||||||
* {@code (ceil(log2(this < 0 ? -this : this+1)))}.)
|
* {@code (ceil(log2(this < 0 ? -this : this+1)))}.)
|
||||||
*
|
*
|
||||||
* @return number of bits in the minimal two's-complement
|
* @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() {
|
public int bitLength() {
|
||||||
int n = bitLengthPlusOne - 1;
|
int n = bitLengthPlusOne - 1;
|
||||||
@ -4034,7 +4037,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
|
|||||||
* Converts this BigInteger to an {@code int}. This
|
* Converts this BigInteger to an {@code int}. This
|
||||||
* conversion is analogous to a
|
* conversion is analogous to a
|
||||||
* <i>narrowing primitive conversion</i> from {@code long} to
|
* <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>:
|
* <cite>The Java™ Language Specification</cite>:
|
||||||
* if this BigInteger is too big to fit in an
|
* if this BigInteger is too big to fit in an
|
||||||
* {@code int}, only the low-order 32 bits are returned.
|
* {@code int}, only the low-order 32 bits are returned.
|
||||||
@ -4044,6 +4047,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
|
|||||||
*
|
*
|
||||||
* @return this BigInteger converted to an {@code int}.
|
* @return this BigInteger converted to an {@code int}.
|
||||||
* @see #intValueExact()
|
* @see #intValueExact()
|
||||||
|
* @jls 5.1.3 Narrowing Primitive Conversion
|
||||||
*/
|
*/
|
||||||
public int intValue() {
|
public int intValue() {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
@ -4055,7 +4059,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
|
|||||||
* Converts this BigInteger to a {@code long}. This
|
* Converts this BigInteger to a {@code long}. This
|
||||||
* conversion is analogous to a
|
* conversion is analogous to a
|
||||||
* <i>narrowing primitive conversion</i> from {@code long} to
|
* <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>:
|
* <cite>The Java™ Language Specification</cite>:
|
||||||
* if this BigInteger is too big to fit in a
|
* if this BigInteger is too big to fit in a
|
||||||
* {@code long}, only the low-order 64 bits are returned.
|
* {@code long}, only the low-order 64 bits are returned.
|
||||||
@ -4065,6 +4069,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
|
|||||||
*
|
*
|
||||||
* @return this BigInteger converted to a {@code long}.
|
* @return this BigInteger converted to a {@code long}.
|
||||||
* @see #longValueExact()
|
* @see #longValueExact()
|
||||||
|
* @jls 5.1.3 Narrowing Primitive Conversion
|
||||||
*/
|
*/
|
||||||
public long longValue() {
|
public long longValue() {
|
||||||
long result = 0;
|
long result = 0;
|
||||||
@ -4078,7 +4083,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
|
|||||||
* Converts this BigInteger to a {@code float}. This
|
* Converts this BigInteger to a {@code float}. This
|
||||||
* conversion is similar to the
|
* conversion is similar to the
|
||||||
* <i>narrowing primitive conversion</i> from {@code double} to
|
* <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>:
|
* <cite>The Java™ Language Specification</cite>:
|
||||||
* if this BigInteger has too great a magnitude
|
* if this BigInteger has too great a magnitude
|
||||||
* to represent as a {@code float}, it will be converted to
|
* to represent as a {@code float}, it will be converted to
|
||||||
@ -4088,6 +4093,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
|
|||||||
* information about the precision of the BigInteger value.
|
* information about the precision of the BigInteger value.
|
||||||
*
|
*
|
||||||
* @return this BigInteger converted to a {@code float}.
|
* @return this BigInteger converted to a {@code float}.
|
||||||
|
* @jls 5.1.3 Narrowing Primitive Conversion
|
||||||
*/
|
*/
|
||||||
public float floatValue() {
|
public float floatValue() {
|
||||||
if (signum == 0) {
|
if (signum == 0) {
|
||||||
@ -4162,7 +4168,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
|
|||||||
* Converts this BigInteger to a {@code double}. This
|
* Converts this BigInteger to a {@code double}. This
|
||||||
* conversion is similar to the
|
* conversion is similar to the
|
||||||
* <i>narrowing primitive conversion</i> from {@code double} to
|
* <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>:
|
* <cite>The Java™ Language Specification</cite>:
|
||||||
* if this BigInteger has too great a magnitude
|
* if this BigInteger has too great a magnitude
|
||||||
* to represent as a {@code double}, it will be converted to
|
* to represent as a {@code double}, it will be converted to
|
||||||
@ -4172,6 +4178,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
|
|||||||
* information about the precision of the BigInteger value.
|
* information about the precision of the BigInteger value.
|
||||||
*
|
*
|
||||||
* @return this BigInteger converted to a {@code double}.
|
* @return this BigInteger converted to a {@code double}.
|
||||||
|
* @jls 5.1.3 Narrowing Primitive Conversion
|
||||||
*/
|
*/
|
||||||
public double doubleValue() {
|
public double doubleValue() {
|
||||||
if (signum == 0) {
|
if (signum == 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user