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 rounding behaviour for numerical operations that may discard precision.


Enum Constant Summary
CEILING
           
DOWN
           
FLOOR
           
HALF_DOWN
           
HALF_EVEN
           
HALF_UP
           
UNNECESSARY
           
UP
           
 
Method Summary
static RoundingMode valueOf(int rm)
          Returns the RoundingMode object corresponding to the legacy rounding modes in BigDecimal.
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, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

UP

public static final RoundingMode UP

DOWN

public static final RoundingMode DOWN

CEILING

public static final RoundingMode CEILING

FLOOR

public static final RoundingMode FLOOR

HALF_UP

public static final RoundingMode HALF_UP

HALF_DOWN

public static final RoundingMode HALF_DOWN

HALF_EVEN

public static final RoundingMode HALF_EVEN

UNNECESSARY

public static final RoundingMode UNNECESSARY
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)
Returns the RoundingMode object corresponding to the legacy rounding modes in BigDecimal.

Parameters:
rm - the legacy rounding mode
Returns:
the corresponding RoundingMode