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

📄 bigdecimal.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 5 页
字号:
</DD></DL><HR><A NAME="multiply(java.math.BigDecimal)"><!-- --></A><H3>multiply</H3><PRE>public <A HREF="../../java/math/BigDecimal.html">BigDecimal</A> <B>multiply</B>(<A HREF="../../java/math/BigDecimal.html">BigDecimal</A>&nbsp;val)</PRE><DL><DD>Returns a BigDecimal whose value is <tt>(this * val)</tt>, and whose scale is <tt>(this.scale() + val.scale())</tt>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>val</CODE> - value to be multiplied by this BigDecimal.<DT><B>Returns:</B><DD><tt>this * val</tt></DL></DD></DL><HR><A NAME="divide(java.math.BigDecimal, int, int)"><!-- --></A><H3>divide</H3><PRE>public <A HREF="../../java/math/BigDecimal.html">BigDecimal</A> <B>divide</B>(<A HREF="../../java/math/BigDecimal.html">BigDecimal</A>&nbsp;val,                         int&nbsp;scale,                         int&nbsp;roundingMode)</PRE><DL><DD>Returns a BigDecimal whose value is <tt>(this / val)</tt>, and whose scale is as specified.  If rounding must be performed to generate a result with the specified scale, the specified rounding mode is applied.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>val</CODE> - value by which this BigDecimal is to be divided.<DD><CODE>scale</CODE> - scale of the BigDecimal quotient to be returned.<DD><CODE>roundingMode</CODE> - rounding mode to apply.<DT><B>Returns:</B><DD><tt>this / val</tt><DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ArithmeticException.html">ArithmeticException</A></CODE> - <tt>val</tt> is zero, <tt>scale</tt> is	       negative, or <tt>roundingMode==ROUND_UNNECESSARY</tt> and	       the specified scale is insufficient to represent the result	       of the division exactly.<DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - <tt>roundingMode</tt> does not	       represent a valid rounding mode.<DT><B>See Also: </B><DD><A HREF="../../java/math/BigDecimal.html#ROUND_UP"><CODE>ROUND_UP</CODE></A>, <A HREF="../../java/math/BigDecimal.html#ROUND_DOWN"><CODE>ROUND_DOWN</CODE></A>, <A HREF="../../java/math/BigDecimal.html#ROUND_CEILING"><CODE>ROUND_CEILING</CODE></A>, <A HREF="../../java/math/BigDecimal.html#ROUND_FLOOR"><CODE>ROUND_FLOOR</CODE></A>, <A HREF="../../java/math/BigDecimal.html#ROUND_HALF_UP"><CODE>ROUND_HALF_UP</CODE></A>, <A HREF="../../java/math/BigDecimal.html#ROUND_HALF_DOWN"><CODE>ROUND_HALF_DOWN</CODE></A>, <A HREF="../../java/math/BigDecimal.html#ROUND_HALF_EVEN"><CODE>ROUND_HALF_EVEN</CODE></A>, <A HREF="../../java/math/BigDecimal.html#ROUND_UNNECESSARY"><CODE>ROUND_UNNECESSARY</CODE></A></DL></DD></DL><HR><A NAME="divide(java.math.BigDecimal, int)"><!-- --></A><H3>divide</H3><PRE>public <A HREF="../../java/math/BigDecimal.html">BigDecimal</A> <B>divide</B>(<A HREF="../../java/math/BigDecimal.html">BigDecimal</A>&nbsp;val,                         int&nbsp;roundingMode)</PRE><DL><DD>Returns a BigDecimal whose value is <tt>(this / val)</tt>, and whose scale is <tt>this.scale()</tt>.  If rounding must be performed to generate a result with the given scale, the specified rounding mode is applied.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>val</CODE> - value by which this BigDecimal is to be divided.<DD><CODE>roundingMode</CODE> - rounding mode to apply.<DT><B>Returns:</B><DD><tt>this / val</tt><DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ArithmeticException.html">ArithmeticException</A></CODE> - <tt>val==0</tt>, or 	       <tt>roundingMode==ROUND_UNNECESSARY</tt> and	       <tt>this.scale()</tt> is insufficient to represent the result	       of the division exactly.<DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - <tt>roundingMode</tt> does not	       represent a valid rounding mode.<DT><B>See Also: </B><DD><A HREF="../../java/math/BigDecimal.html#ROUND_UP"><CODE>ROUND_UP</CODE></A>, <A HREF="../../java/math/BigDecimal.html#ROUND_DOWN"><CODE>ROUND_DOWN</CODE></A>, <A HREF="../../java/math/BigDecimal.html#ROUND_CEILING"><CODE>ROUND_CEILING</CODE></A>, <A HREF="../../java/math/BigDecimal.html#ROUND_FLOOR"><CODE>ROUND_FLOOR</CODE></A>, <A HREF="../../java/math/BigDecimal.html#ROUND_HALF_UP"><CODE>ROUND_HALF_UP</CODE></A>, <A HREF="../../java/math/BigDecimal.html#ROUND_HALF_DOWN"><CODE>ROUND_HALF_DOWN</CODE></A>, <A HREF="../../java/math/BigDecimal.html#ROUND_HALF_EVEN"><CODE>ROUND_HALF_EVEN</CODE></A>, <A HREF="../../java/math/BigDecimal.html#ROUND_UNNECESSARY"><CODE>ROUND_UNNECESSARY</CODE></A></DL></DD></DL><HR><A NAME="abs()"><!-- --></A><H3>abs</H3><PRE>public <A HREF="../../java/math/BigDecimal.html">BigDecimal</A> <B>abs</B>()</PRE><DL><DD>Returns a BigDecimal whose value is the absolute value of this BigDecimal, and whose scale is <tt>this.scale()</tt>.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD><tt>abs(this)</tt></DL></DD></DL><HR><A NAME="negate()"><!-- --></A><H3>negate</H3><PRE>public <A HREF="../../java/math/BigDecimal.html">BigDecimal</A> <B>negate</B>()</PRE><DL><DD>Returns a BigDecimal whose value is <tt>(-this)</tt>, and whose scale is this.scale().<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD><tt>-this</tt></DL></DD></DL><HR><A NAME="signum()"><!-- --></A><H3>signum</H3><PRE>public int <B>signum</B>()</PRE><DL><DD>Returns the signum function of this BigDecimal.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>-1, 0 or 1 as the value of this BigDecimal is negative, zero or	       positive.</DL></DD></DL><HR><A NAME="scale()"><!-- --></A><H3>scale</H3><PRE>public int <B>scale</B>()</PRE><DL><DD>Returns the <i>scale</i> of this BigDecimal.  (The scale is the number of digits to the right of the decimal point.)<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the scale of this BigDecimal.</DL></DD></DL><HR><A NAME="unscaledValue()"><!-- --></A><H3>unscaledValue</H3><PRE>public <A HREF="../../java/math/BigInteger.html">BigInteger</A> <B>unscaledValue</B>()</PRE><DL><DD>Returns a BigInteger whose value is the <i>unscaled value</i> of this BigDecimal.  (Computes <tt>(this * 10<sup>this.scale()</sup>)</tt>.)<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the unscaled value of this BigDecimal.<DT><B>Since: </B><DD>1.2</DD></DL></DD></DL><HR><A NAME="setScale(int, int)"><!-- --></A><H3>setScale</H3><PRE>public <A HREF="../../java/math/BigDecimal.html">BigDecimal</A> <B>setScale</B>(int&nbsp;scale,                           int&nbsp;roundingMode)</PRE><DL><DD>Returns a BigDecimal whose scale is the specified value, and whose unscaled value is determined by multiplying or dividing this BigDecimal's unscaled value by the appropriate power of ten to maintain its overall value.  If the scale is reduced by the operation, the unscaled value must be divided (rather than multiplied), and the value may be changed; in this case, the specified rounding mode is applied to the division.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>scale</CODE> - scale of the BigDecimal value to be returned.<DD><CODE>roundingMode</CODE> - The rounding mode to apply.<DT><B>Returns:</B><DD>a BigDecimal whose scale is the specified value, and whose	       unscaled value is determined by multiplying or dividing this 	       BigDecimal's unscaled value by the appropriate power of ten to	       maintain its overall value.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ArithmeticException.html">ArithmeticException</A></CODE> - <tt>scale</tt> is negative, or 	       <tt>roundingMode==ROUND_UNNECESSARY</tt> and the specified	       scaling operation would require rounding.<DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - <tt>roundingMode</tt> does not	       represent a valid rounding mode.<DT><B>See Also: </B><DD><A HREF="../../java/math/BigDecimal.html#ROUND_UP"><CODE>ROUND_UP</CODE></A>, <A HREF="../../java/math/BigDecimal.html#ROUND_DOWN"><CODE>ROUND_DOWN</CODE></A>, <A HREF="../../java/math/BigDecimal.html#ROUND_CEILING"><CODE>ROUND_CEILING</CODE></A>, <A HREF="../../java/math/BigDecimal.html#ROUND_FLOOR"><CODE>ROUND_FLOOR</CODE></A>, <A HREF="../../java/math/BigDecimal.html#ROUND_HALF_UP"><CODE>ROUND_HALF_UP</CODE></A>, <A HREF="../../java/math/BigDecimal.html#ROUND_HALF_DOWN"><CODE>ROUND_HALF_DOWN</CODE></A>, <A HREF="../../java/math/BigDecimal.html#ROUND_HALF_EVEN"><CODE>ROUND_HALF_EVEN</CODE></A>, <A HREF="../../java/math/BigDecimal.html#ROUND_UNNECESSARY"><CODE>ROUND_UNNECESSARY</CODE></A></DL></DD></DL><HR><A NAME="setScale(int)"><!-- --></A><H3>setScale</H3><PRE>public <A HREF="../../java/math/BigDecimal.html">BigDecimal</A> <B>setScale</B>(int&nbsp;scale)</PRE><DL><DD>Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to this BigDecimal'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 BigDecimal 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. <p> 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.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>scale</CODE> - scale of the BigDecimal value to be returned.<DT><B>Returns:</B><DD>a BigDecimal whose scale is the specified value, and whose	       unscaled value is determined by multiplying or dividing this 	       BigDecimal's unscaled value by the appropriate power of ten to	       maintain its overall value.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ArithmeticException.html">ArithmeticException</A></CODE> - <tt>scale</tt> is negative, or 	       the specified scaling operation would require rounding.<DT><B>See Also: </B><DD><A HREF="../../java/math/BigDecimal.html#setScale(int, int)"><CODE>setScale(int, int)</CODE></A></DL></DD></DL><HR><A NAME="movePointLeft(int)"><!-- --></A><H3>movePointLeft</H3><PRE>public <A HREF="../../java/math/BigDecimal.html">BigDecimal</A> <B>movePointLeft</B>(int&nbsp;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 <tt>(this * 10<sup>-n</sup>)</tt> and scale <tt>max(this.scale()+n, 0)</tt>.)<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>n</CODE> - number of places to move the decimal point to the left.<DT><B>Returns:</B><DD>a BigDecimal which is equivalent to this one with the decimal	       point moved <tt>n</tt> places to the left.</DL></DD></DL><HR><A NAME="movePointRight(int)"><!-- --></A><H3>movePointRight</H3><PRE>public <A HREF="../../java/math/BigDecimal.html">BigDecimal</A> <B>movePointRight</B>(int&nbsp;n)</PRE><DL><DD>Moves the decimal point the specified number of places to the right. If this BigDecimal's scale is &gt;= <tt>n</tt>, the call merely subtracts <tt>n</tt> from the scale; otherwise, it sets the scale to zero, and multiplies the integer value by <tt>10<sup>(n - this.scale)</sup></tt>.  If <tt>n</tt> is negative, the call is equivalent to <tt>movePointLeft(-n)</tt>. (The BigDecimal returned by this call has value <tt>(this * 10<sup>n</sup>)</tt> and scale <tt>max(this.scale()-n, 0)</tt>.)<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>n</CODE> - number of places to move the decimal point to the right.<DT><B>Returns:</B><DD>a BigDecimal which is equivalent to this one with the decimal         point moved <tt>n</tt> places to the right.</DL></DD></DL><HR><A NAME="compareTo(java.math.BigDecimal)"><!-- --></A><H3>compareTo</H3><PRE>public int <B>compareTo</B>(<A HREF="../../java/math/BigDecimal.html">BigDecimal</A>&nbsp;val)</PRE>

⌨️ 快捷键说明

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