Build 1.0_r1(from source)

java.math
Enum RoundingMode

java.lang.Object
  extended by java.lang.Enum<RoundingMode>
      extended by java.math.RoundingMode
All Implemented Interfaces:
Serializable, Comparable<RoundingMode>

public enum RoundingMode
extends Enum<RoundingMode>

An enum to specify the rounding behaviour for operations whose results cannot be represented exactly.


Enum Constant Summary
CEILING
          Rounding mode to round towards positive infinity.
DOWN
          Rounding mode where the values are rounded towards zero.
FLOOR
          Rounding mode to round towards negative infinity.
HALF_DOWN
          Rounding mode where values are rounded towards the nearest neighbour.
HALF_EVEN
          Rounding mode where values are rounded towards the nearest neighbour.
HALF_UP
          Rounding mode where values are rounded towards the nearest neighbour.
UNNECESSARY
          Rounding mode where the rounding operations throws an ArithmeticException for the case that rounding is necessary, i.e.
UP
          Rounding mode where positive values are rounded towards positive infinity and negative values towards negative infinity.
 
Method Summary
static RoundingMode valueOf(int rM)
          Converts rounding mode constants from class BigDecimal into RoundingMode values.
static RoundingMode valueOf(String name)
          Returns the enum constant of this type with the specified name.
static RoundingMode[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

UP

public static final RoundingMode UP
Rounding mode where positive values are rounded towards positive infinity and negative values towards negative infinity. Rule: x.round().abs() >= x.abs()


DOWN

public static final RoundingMode DOWN
Rounding mode where the values are rounded towards zero. Rule: x.round().abs() <= x.abs()="">


CEILING

public static final RoundingMode CEILING
Rounding mode to round towards positive infinity. For positive values this rounding mode behaves as UP, for negative values as DOWN. Rule: x.round() >= x


FLOOR

public static final RoundingMode FLOOR
Rounding mode to round towards negative infinity. For positive values this rounding mode behaves as DOWN, for negative values as UP. Rule: x.round() <= x="">


HALF_UP

public static final RoundingMode HALF_UP
Rounding mode where values are rounded towards the nearest neighbour. Ties are broken by rounding up.


HALF_DOWN

public static final RoundingMode HALF_DOWN
Rounding mode where values are rounded towards the nearest neighbour. Ties are broken by rounding down.


HALF_EVEN

public static final RoundingMode HALF_EVEN
Rounding mode where values are rounded towards the nearest neighbour. Ties are broken by rounding to the even neighbour.


UNNECESSARY

public static final RoundingMode UNNECESSARY
Rounding mode where the rounding operations throws an ArithmeticException for the case that rounding is necessary, i.e. for the case that the value cannot be represented exactly.

Method Detail

values

public static RoundingMode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (RoundingMode c : RoundingMode.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static RoundingMode valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

valueOf

public static RoundingMode valueOf(int rM)
Converts rounding mode constants from class BigDecimal into RoundingMode values.

Parameters:
rM - rounding mode constant as defined in class BigDecimal
Returns:
corresponding rounding mode object

Build 1.0_r1(from source)

Please submit a feedback, bug or feature