<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Wed Jul 28 01:21:15 GMT 1999 -->
<title>
  Class java.math.BigDecimal
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.math.html">This Package</a>  <a href="Package-java.math.html">Previous</a>  <a href="java.math.BigInteger.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class java.math.BigDecimal
</h1>
<pre>
<a href="java.lang.Object.html#_top_">java.lang.Object</a>
   |
   +----<a href="java.lang.Number.html#_top_">java.lang.Number</a>
           |
           +----java.math.BigDecimal
</pre>
<hr>
<dl>
  <dt> public class <b>BigDecimal</b>
  <dt> extends <a href="java.lang.Number.html#_top_">Number</a>
</dl>
Immutable, arbitrary-precision signed decimal numbers.  A BigDecimal
 consists of an arbitrary precision integer value and a non-negative
 integer scale, which represents the number of decimal digits to the
 right of the decimal point.  (The number represented by the BigDecimal
 is intVal/10**scale.)  BigDecimals provide operations for basic arithmetic,
 scale manipulation, comparison, format conversion and hashing.
 <p>The BigDecimal class gives its user complete control over rounding
 behavior, forcing the user to explicitly specify a rounding behavior for
 operations capable of discarding precision (divide and setScale).  Eight
 <em>rounding modes</em> are provided for this purpose.
 Two types of operations are provided for manipulating the scale of a
 BigDecimal: scaling/rounding operations and decimal point motion operations.
 Scaling/Rounding operations (SetScale) return a BigDecimal whose value is
 approximately (or exactly) equal to that of the operand, but whose scale is
 the specified value; that is, they increase or decrease the precision
 of the number with minimal effect on its value.  Decimal point motion
 operations (movePointLeft and movePointRight) return a BigDecimal created
 from the operand by moving the decimal point a specified distance in the
 specified direction; that is, they change a number's value without affecting
 its precision.
<p>
<dl>
    <dt> <b>See Also:</b>
    <dd> <a href="java.math.BigInteger.html#_top_">BigInteger</a>
</dl>
<hr>
<a name="index"></a>
<h2>
  <img src="images/variable-index.gif" width=207 height=38 alt="Variable Index">
</h2>
<dl>
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#ROUND_CEILING"><b>ROUND_CEILING</b></a>
  <dd>  If the BigDecimal is positive, behave as for ROUND_UP; if negative,
 behave as for ROUND_DOWN.
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#ROUND_DOWN"><b>ROUND_DOWN</b></a>
  <dd>  Never increment the digit prior to a discarded fraction (i.e.,
 truncate).
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#ROUND_FLOOR"><b>ROUND_FLOOR</b></a>
  <dd>  If the BigDecimal is positive, behave as for ROUND_DOWN; if negative
 behave as for ROUND_UP.
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#ROUND_HALF_DOWN"><b>ROUND_HALF_DOWN</b></a>
  <dd>  Behave as for ROUND_UP if the discarded fraction is > .5; otherwise,
 behave as for ROUND_DOWN.
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#ROUND_HALF_EVEN"><b>ROUND_HALF_EVEN</b></a>
  <dd>  Behave as for ROUND_HALF_UP if the digit to the left of the discarded
 fraction is odd; behave as for ROUND_HALF_DOWN if it's even.
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#ROUND_HALF_UP"><b>ROUND_HALF_UP</b></a>
  <dd>  Behave as for ROUND_UP if the discarded fraction is >= .5; otherwise,
 behave as for ROUND_DOWN.
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#ROUND_UNNECESSARY"><b>ROUND_UNNECESSARY</b></a>
  <dd>  This "pseudo-rounding-mode" is actually an assertion that the requested
 operation has an exact result, hence no rounding is necessary.
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#ROUND_UP"><b>ROUND_UP</b></a>
  <dd>  Always increment the digit prior to a non-zero discarded fraction.
</dl>
<h2>
  <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#BigDecimal(java.math.BigInteger)"><b>BigDecimal</b></a>(BigInteger)
  <dd>  Translates a BigInteger into a BigDecimal.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#BigDecimal(java.math.BigInteger, int)"><b>BigDecimal</b></a>(BigInteger, int)
  <dd>  Translates a BigInteger and a scale into a BigDecimal.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#BigDecimal(double)"><b>BigDecimal</b></a>(double)
  <dd>  Translates a double into a BigDecimal.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#BigDecimal(java.lang.String)"><b>BigDecimal</b></a>(String)
  <dd>  Constructs a BigDecimal from a string containing an optional minus
 sign followed by a sequence of zero or more decimal digits, optionally
 followed by a fraction, which consists of a decimal point followed by
 zero or more decimal digits.
</dl>
<h2>
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#abs()"><b>abs</b></a>()
  <dd>  Returns a BigDecimal whose value is the absolute value of this
 number, and whose scale is this.scale().
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#add(java.math.BigDecimal)"><b>add</b></a>(BigDecimal)
  <dd>  Returns a BigDecimal whose value is (this + val), and whose scale is
 MAX(this.scale(), val.scale).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#compareTo(java.math.BigDecimal)"><b>compareTo</b></a>(BigDecimal)
  <dd>  Returns -1, 0 or 1 as this number is less than, equal to, or greater
 than val.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#divide(java.math.BigDecimal, int)"><b>divide</b></a>(BigDecimal, int)
  <dd>  Returns a BigDecimal whose value is (this / val), and whose scale
 is this.scale().
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#divide(java.math.BigDecimal, int, int)"><b>divide</b></a>(BigDecimal, int, int)
  <dd>  Returns a BigDecimal whose value is (this / val), and whose scale
 is as specified.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#doubleValue()"><b>doubleValue</b></a>()
  <dd>  Converts the number to a double.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#equals(java.lang.Object)"><b>equals</b></a>(Object)
  <dd>  Returns true iff x is a BigDecimal whose value is equal to this number.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#floatValue()"><b>floatValue</b></a>()
  <dd>  Converts this number to a float.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#hashCode()"><b>hashCode</b></a>()
  <dd>  Computes a hash code for this object.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#intValue()"><b>intValue</b></a>()
  <dd>  Converts this number to an int.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#longValue()"><b>longValue</b></a>()
  <dd>  Converts this number to a long.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#max(java.math.BigDecimal)"><b>max</b></a>(BigDecimal)
  <dd>  Returns the BigDecimal whose value is the greater of this and val.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#min(java.math.BigDecimal)"><b>min</b></a>(BigDecimal)
  <dd>  Returns the BigDecimal whose value is the lesser of this and val.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#movePointLeft(int)"><b>movePointLeft</b></a>(int)
  <dd>  Returns a BigDecimal which is equivalent to this one with the decimal
 point moved n places to the left.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#movePointRight(int)"><b>movePointRight</b></a>(int)
  <dd>  Moves the decimal point the specified number of places to the right.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#multiply(java.math.BigDecimal)"><b>multiply</b></a>(BigDecimal)
  <dd>  Returns a BigDecimal whose value is (this * val), and whose scale is
 this.scale() + val.scale.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#negate()"><b>negate</b></a>()
  <dd>  Returns a BigDecimal whose value is -1 * this, and whose scale is
 this.scale().
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#scale()"><b>scale</b></a>()
  <dd>  Returns the scale of this number.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setScale(int)"><b>setScale</b></a>(int)
  <dd>  Returns a BigDecimal whose scale is the specified value, and whose
 value is exactly equal to this number's.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setScale(int, int)"><b>setScale</b></a>(int, int)
  <dd>  Returns a BigDecimal whose scale is the specified value, and whose
 integer value is determined by multiplying or dividing this BigDecimal's
 integer value by the appropriate power of ten to maintain the overall
 value.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#signum()"><b>signum</b></a>()
  <dd>  Returns the signum function of this number (i.e., -1, 0 or 1 as
 the value of this number is negative, zero or positive).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#subtract(java.math.BigDecimal)"><b>subtract</b></a>(BigDecimal)
  <dd>  Returns a BigDecimal whose value is (this - val), and whose scale is
 MAX(this.scale(), val.scale).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#toBigInteger()"><b>toBigInteger</b></a>()
  <dd>  Converts this number to a BigInteger.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#toString()"><b>toString</b></a>()
  <dd>  Returns the string representation of this number.
  <dt> <img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#valueOf(long)"><b>valueOf</b></a>(long)
  <dd>  Returns a BigDecimal with the given value and a scale of zero.
  <dt> <img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#valueOf(long, int)"><b>valueOf</b></a>(long, int)
  <dd>  Returns a BigDecimal with a value of (val/10**scale).
</dl>
<a name="variables"></a>
<h2>
  <img src="images/variables.gif" width=153 height=38 alt="Variables">
</h2>
<a name="ROUND_UP"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>ROUND_UP</b>
<pre>
 public static final int ROUND_UP
</pre>
<dl>
  <dd> Always increment the digit prior to a non-zero discarded fraction.
 Note that this rounding mode never decreases the magnitude.
 (Rounds away from zero.)<p>
</dl>
<a name="ROUND_DOWN"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>ROUND_DOWN</b>
<pre>
 public static final int ROUND_DOWN
</pre>
<dl>
  <dd> Never increment the digit prior to a discarded fraction (i.e.,
 truncate).  Note that this rounding mode never increases the magnitude.
 (Rounds towards zero.)<p>
</dl>
<a name="ROUND_CEILING"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>ROUND_CEILING</b>
<pre>
 public static final int ROUND_CEILING
</pre>
<dl>
  <dd> If the BigDecimal is positive, behave as for ROUND_UP; if negative,
 behave as for ROUND_DOWN.  Note that this rounding mode never decreases
 the value.  (Rounds towards positive infinity.)<p>
</dl>
<a name="ROUND_FLOOR"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>ROUND_FLOOR</b>
<pre>
 public static final int ROUND_FLOOR
</pre>
<dl>
  <dd> If the BigDecimal is positive, behave as for ROUND_DOWN; if negative
 behave as for ROUND_UP.  Note that this rounding mode never increases
 the value.  (Rounds towards negative infinity.)<p>
</dl>
<a name="ROUND_HALF_UP"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>ROUND_HALF_UP</b>
<pre>
 public static final int ROUND_HALF_UP
</pre>
<dl>
  <dd> Behave as for ROUND_UP if the discarded fraction is >= .5; otherwise,
 behave as for ROUND_DOWN.  (Rounds towards "nearest neighbor" unless
 both neighbors are equidistant, in which case rounds up.)<p>
</dl>
<a name="ROUND_HALF_DOWN"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>ROUND_HALF_DOWN</b>
<pre>
 public static final int ROUND_HALF_DOWN
</pre>
<dl>
  <dd> Behave as for ROUND_UP if the discarded fraction is > .5; otherwise,
 behave as for ROUND_DOWN.   (Rounds towards "nearest neighbor" unless
 both neighbors are equidistant, in which case rounds down.)<p>
</dl>
<a name="ROUND_HALF_EVEN"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>ROUND_HALF_EVEN</b>
<pre>
 public static final int ROUND_HALF_EVEN
</pre>
<dl>
  <dd> Behave as for ROUND_HALF_UP if the digit to the left of the discarded
 fraction is odd; behave as for ROUND_HALF_DOWN if it's even.  (Rounds
 towards the "nearest neighbor" unless both neighbors are equidistant,
 in which case, rounds towards the even neighbor.)<p>
</dl>
<a name="ROUND_UNNECESSARY"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>ROUND_UNNECESSARY</b>
<pre>
 public static final int ROUND_UNNECESSARY
</pre>
<dl>
  <dd> This "pseudo-rounding-mode" is actually an assertion that the requested
 operation has an exact result, hence no rounding is necessary.  If this
 rounding mode is specified on an operation that yields an inexact result,
 an arithmetic exception is thrown.<p>
</dl>
<a name="constructors"></a>
<h2>
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="BigDecimal"></a>
<a name="BigDecimal(java.lang.String)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>BigDecimal</b>
<pre>
 public BigDecimal(<a href="java.lang.String.html#_top_">String</a> val) throws <a href="java.lang.NumberFormatException.html#_top_">NumberFormatException</a>
</pre>
<dl>
  <dd> Constructs a BigDecimal from a string containing an optional minus
 sign followed by a sequence of zero or more decimal digits, optionally
 followed by a fraction, which consists of a decimal point followed by
 zero or more decimal digits.  The string must contain at least one
 digit in the integer or fractional part.  The scale of the resulting
 BigDecimal will be the number of digits to the right of the decimal
 point in the string, or 0 if the string contains no decimal point.
 The character-to-digit mapping is provided by Character.digit.
 Any extraneous characters (including whitespace) will result in
 a NumberFormatException.
<p>
</dl>
<a name="BigDecimal(double)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>BigDecimal</b>
<pre>
 public BigDecimal(double val) throws <a href="java.lang.NumberFormatException.html#_top_">NumberFormatException</a>
</pre>
<dl>
  <dd> Translates a double into a BigDecimal.  The scale of the BigDecimal
 is the smallest value such that (10**scale * val) is an integer.
 A double whose value is -infinity, +infinity or NaN will result in a
 NumberFormatException.
<p>
</dl>
<a name="BigDecimal(java.math.BigInteger)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>BigDecimal</b>
<pre>
 public BigDecimal(<a href="java.math.BigInteger.html#_top_">BigInteger</a> val)
</pre>
<dl>
  <dd> Translates a BigInteger into a BigDecimal.  The scale of the BigDecimal
 is zero.
<p>
</dl>
<a name="BigDecimal(java.math.BigInteger, int)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>BigDecimal</b>
<pre>
 public BigDecimal(<a href="java.math.BigInteger.html#_top_">BigInteger</a> val,
                   int scale) throws <a href="java.lang.NumberFormatException.html#_top_">NumberFormatException</a>
</pre>
<dl>
  <dd> Translates a BigInteger and a scale into a BigDecimal.  The value
 of the BigDecimal is (BigInteger/10**scale).  A negative scale
 will result in a NumberFormatException.
<p>
</dl>
<a name="methods"></a>
<h2>
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="valueOf(long, int)"><img src="images/green-ball.gif" width=12 height=12 alt=" o "></a>
<a name="valueOf"><b>valueOf</b></a>
<pre>
 public static <a href="#_top_">BigDecimal</a> valueOf(long val,
                                  int scale) throws <a href="java.lang.NumberFormatException.html#_top_">NumberFormatException</a>
</pre>
<dl>
  <dd> Returns a BigDecimal with a value of (val/10**scale).  This factory
 is provided in preference to a (long) constructor because it allows
 for reuse of frequently used BigDecimals (like 0 and 1), obviating
 the need for exported constants.  A negative scale will result in a
 NumberFormatException.
<p>
</dl>
<a name="valueOf(long)"><img src="images/green-ball.gif" width=12 height=12 alt=" o "></a>
<a name="valueOf"><b>valueOf</b></a>
<pre>
 public static <a href="#_top_">BigDecimal</a> valueOf(long val)
</pre>
<dl>
  <dd> Returns a BigDecimal with the given value and a scale of zero.
 This factory is provided in preference to a (long) constructor
 because it allows for reuse of frequently used BigDecimals (like
 0 and 1), obviating the need for exported constants.
<p>
</dl>
<a name="add(java.math.BigDecimal)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="add"><b>add</b></a>
<pre>
 public <a href="#_top_">BigDecimal</a> add(<a href="#_top_">BigDecimal</a> val)
</pre>
<dl>
  <dd> Returns a BigDecimal whose value is (this + val), and whose scale is
 MAX(this.scale(), val.scale).
<p>
</dl>
<a name="subtract(java.math.BigDecimal)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="subtract"><b>subtract</b></a>
<pre>
 public <a href="#_top_">BigDecimal</a> subtract(<a href="#_top_">BigDecimal</a> val)
</pre>
<dl>
  <dd> Returns a BigDecimal whose value is (this - val), and whose scale is
 MAX(this.scale(), val.scale).
<p>
</dl>
<a name="multiply(java.math.BigDecimal)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="multiply"><b>multiply</b></a>
<pre>
 public <a href="#_top_">BigDecimal</a> multiply(<a href="#_top_">BigDecimal</a> val)
</pre>
<dl>
  <dd> Returns a BigDecimal whose value is (this * val), and whose scale is
 this.scale() + val.scale.
<p>
</dl>
<a name="divide(java.math.BigDecimal, int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="divide"><b>divide</b></a>
<pre>
 public <a href="#_top_">BigDecimal</a> divide(<a href="#_top_">BigDecimal</a> val,
                          int scale,
                          int roundingMode) throws <a href="java.lang.ArithmeticException.html#_top_">ArithmeticException</a>, <a href="java.lang.IllegalArgumentException.html#_top_">IllegalArgumentException</a>
</pre>
<dl>
  <dd> Returns a BigDecimal whose value is (this / val), and whose scale
 is as specified.  If rounding must be performed to generate a
 result with the given scale, the specified rounding mode is
 applied.  Throws an ArithmeticException if val == 0, scale < 0,
 or the rounding mode is ROUND_UNNECESSARY and the specified scale
 is insufficient to represent the result of the division exactly.
 Throws an IllegalArgumentException if roundingMode does not
 represent a valid rounding mode.
<p>
</dl>
<a name="divide(java.math.BigDecimal, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="divide"><b>divide</b></a>
<pre>
 public <a href="#_top_">BigDecimal</a> divide(<a href="#_top_">BigDecimal</a> val,
                          int roundingMode) throws <a href="java.lang.ArithmeticException.html#_top_">ArithmeticException</a>, <a href="java.lang.IllegalArgumentException.html#_top_">IllegalArgumentException</a>
</pre>
<dl>
  <dd> Returns a BigDecimal whose value is (this / val), and whose scale
 is this.scale().  If rounding must be performed to generate a
 result with the given scale, the specified rounding mode is
 applied.  Throws an ArithmeticException if val == 0.  Throws
 an IllegalArgumentException if roundingMode does not represent a
 valid rounding mode.
<p>
</dl>
<a name="abs()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="abs"><b>abs</b></a>
<pre>
 public <a href="#_top_">BigDecimal</a> abs()
</pre>
<dl>
  <dd> Returns a BigDecimal whose value is the absolute value of this
 number, and whose scale is this.scale().
<p>
</dl>
<a name="negate()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="negate"><b>negate</b></a>
<pre>
 public <a href="#_top_">BigDecimal</a> negate()
</pre>
<dl>
  <dd> Returns a BigDecimal whose value is -1 * this, and whose scale is
 this.scale().
<p>
</dl>
<a name="signum()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="signum"><b>signum</b></a>
<pre>
 public int signum()
</pre>
<dl>
  <dd> Returns the signum function of this number (i.e., -1, 0 or 1 as
 the value of this number is negative, zero or positive).
<p>
</dl>
<a name="scale()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="scale"><b>scale</b></a>
<pre>
 public int scale()
</pre>
<dl>
  <dd> Returns the scale of this number.
<p>
</dl>
<a name="setScale(int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setScale"><b>setScale</b></a>
<pre>
 public <a href="#_top_">BigDecimal</a> setScale(int scale,
                            int roundingMode) throws <a href="java.lang.ArithmeticException.html#_top_">ArithmeticException</a>, <a href="java.lang.IllegalArgumentException.html#_top_">IllegalArgumentException</a>
</pre>
<dl>
  <dd> Returns a BigDecimal whose scale is the specified value, and whose
 integer value is determined by multiplying or dividing this BigDecimal's
 integer value by the appropriate power of ten to maintain the overall
 value.  If the scale is reduced by the operation, the integer value
 must be divided (rather than multiplied), and precision may be lost;
 in this case, the specified rounding mode is applied to the division.
 Throws an ArithmeticException if scale is negative, or the rounding
 mode is ROUND_UNNECESSARY and it is impossible to perform the
 specified scaling operation without loss of precision.  Throws an
 IllegalArgumentException if roundingMode does not represent a valid
 rounding mode.
<p>
</dl>
<a name="setScale(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setScale"><b>setScale</b></a>
<pre>
 public <a href="#_top_">BigDecimal</a> setScale(int scale) throws <a href="java.lang.ArithmeticException.html#_top_">ArithmeticException</a>, <a href="java.lang.IllegalArgumentException.html#_top_">IllegalArgumentException</a>
</pre>
<dl>
  <dd> Returns a BigDecimal whose scale is the specified value, and whose
 value is exactly equal to this number's.  Throws an ArithmeticException
 if this is not possible.  This call is typically used to increase
 the scale, in which case it is guaranteed that there exists a BigDecimal
 of the specified scale and the correct value.  The call can also be used
 to reduce the scale if the caller knows that the number has sufficiently
 many zeros at the end of its fractional part (i.e., factors of ten in
 its integer value) to allow for the rescaling without loss of precision.
 Note that this call returns the same result as the two argument version
 of setScale, but saves the caller the trouble of specifying a rounding
 mode in cases where it is irrelevant.
<p>
</dl>
<a name="movePointLeft(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="movePointLeft"><b>movePointLeft</b></a>
<pre>
 public <a href="#_top_">BigDecimal</a> movePointLeft(int n)
</pre>
<dl>
  <dd> Returns a BigDecimal which is equivalent to this one with the decimal
 point moved n places to the left.  If n is non-negative, the call merely
 adds n to the scale.  If n is negative, the call is equivalent to
 movePointRight(-n).  (The BigDecimal returned by this call has value
 (this * 10**-n) and scale MAX(this.scale()+n, 0).)
<p>
</dl>
<a name="movePointRight(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="movePointRight"><b>movePointRight</b></a>
<pre>
 public <a href="#_top_">BigDecimal</a> movePointRight(int n)
</pre>
<dl>
  <dd> Moves the decimal point the specified number of places to the right.
 If this number's scale is >= n, the call merely subtracts n from the
 scale; otherwise, it sets the scale to zero, and multiplies the integer
 value by 10 ** (n - this.scale).  If n is negative, the call is
 equivalent to movePointLeft(-n). (The BigDecimal returned by this call
 has value (this * 10**n) and scale MAX(this.scale()-n, 0).)
<p>
</dl>
<a name="compareTo(java.math.BigDecimal)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="compareTo"><b>compareTo</b></a>
<pre>
 public int compareTo(<a href="#_top_">BigDecimal</a> val)
</pre>
<dl>
  <dd> Returns -1, 0 or 1 as this number is less than, equal to, or greater
 than val.  Two BigDecimals that are equal in value but have a
 different scale (e.g., 2.0, 2.00) are considered equal by this method.
 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:  (x.compareTo(y)
 <op> 0), where <op> is one of the six comparison operators.
<p>
</dl>
<a name="equals(java.lang.Object)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="equals"><b>equals</b></a>
<pre>
 public boolean equals(<a href="java.lang.Object.html#_top_">Object</a> x)
</pre>
<dl>
  <dd> Returns true iff x is a BigDecimal whose value is equal to this number.
 This method is provided so that BigDecimals can be used as hash keys.
 Unlike compareTo, this method considers two BigDecimals equal only
 if they are equal in value and scale.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Object.html#equals(java.lang.Object)">equals</a> in class <a href="java.lang.Object.html#_top_">Object</a>
  </dl></dd>
</dl>
<a name="min(java.math.BigDecimal)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="min"><b>min</b></a>
<pre>
 public <a href="#_top_">BigDecimal</a> min(<a href="#_top_">BigDecimal</a> val)
</pre>
<dl>
  <dd> Returns the BigDecimal whose value is the lesser of this and val.
 If the values are equal (as defined by the compareTo operator),
 either may be returned.
<p>
</dl>
<a name="max(java.math.BigDecimal)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="max"><b>max</b></a>
<pre>
 public <a href="#_top_">BigDecimal</a> max(<a href="#_top_">BigDecimal</a> val)
</pre>
<dl>
  <dd> Returns the BigDecimal whose value is the greater of this and val.
 If the values are equal (as defined by the compareTo operator),
 either may be returned.
<p>
</dl>
<a name="hashCode()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="hashCode"><b>hashCode</b></a>
<pre>
 public int hashCode()
</pre>
<dl>
  <dd> Computes a hash code for this object.  Note that two BigDecimals
 that are numerically equal but differ in scale (e.g., 2.0, 2.00) will
 not generally have the same hash code.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Object.html#hashCode()">hashCode</a> in class <a href="java.lang.Object.html#_top_">Object</a>
  </dl></dd>
</dl>
<a name="toString()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="toString"><b>toString</b></a>
<pre>
 public <a href="java.lang.String.html#_top_">String</a> toString()
</pre>
<dl>
  <dd> Returns the string representation of this number.  The digit-to-
 character mapping provided by Character.forDigit is used.  The minus
 sign and decimal point are used to indicate sign and scale.  (This
 representation is compatible with the (String, int) constructor.)
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Object.html#toString()">toString</a> in class <a href="java.lang.Object.html#_top_">Object</a>
  </dl></dd>
</dl>
<a name="toBigInteger()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="toBigInteger"><b>toBigInteger</b></a>
<pre>
 public <a href="java.math.BigInteger.html#_top_">BigInteger</a> toBigInteger()
</pre>
<dl>
  <dd> Converts this number to a BigInteger.  Standard narrowing primitive
 conversion as per The Java Language Specification.  In particular,
 note that any fractional part of this number will be truncated.
<p>
</dl>
<a name="intValue()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="intValue"><b>intValue</b></a>
<pre>
 public int intValue()
</pre>
<dl>
  <dd> Converts this number to an int.  Standard narrowing primitive conversion
 as per The Java Language Specification.  In particular, note that any
 fractional part of this number will be truncated.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Number.html#intValue()">intValue</a> in class <a href="java.lang.Number.html#_top_">Number</a>
  </dl></dd>
</dl>
<a name="longValue()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="longValue"><b>longValue</b></a>
<pre>
 public long longValue()
</pre>
<dl>
  <dd> Converts this number to a long.  Standard narrowing primitive conversion
 as per The Java Language Specification.  In particular, note that any
 fractional part of this number will be truncated.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Number.html#longValue()">longValue</a> in class <a href="java.lang.Number.html#_top_">Number</a>
  </dl></dd>
</dl>
<a name="floatValue()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="floatValue"><b>floatValue</b></a>
<pre>
 public float floatValue()
</pre>
<dl>
  <dd> Converts this number to a float.  Similar to the double-to-float
 narrowing primitive conversion defined in The Java Language
 Specification: if the number has too great a magnitude to represent
 as a float, it will be converted to infinity or negative infinity,
 as appropriate.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Number.html#floatValue()">floatValue</a> in class <a href="java.lang.Number.html#_top_">Number</a>
  </dl></dd>
</dl>
<a name="doubleValue()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="doubleValue"><b>doubleValue</b></a>
<pre>
 public double doubleValue()
</pre>
<dl>
  <dd> Converts the number to a double.  Similar to the double-to-float
 narrowing primitive conversion defined in The Java Language
 Specification: if the number has too great a magnitude to represent
 as a double, it will be converted to infinity or negative infinity,
 as appropriate.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Number.html#doubleValue()">doubleValue</a> in class <a href="java.lang.Number.html#_top_">Number</a>
  </dl></dd>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.math.html">This Package</a>  <a href="Package-java.math.html">Previous</a>  <a href="java.math.BigInteger.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
