public enum SimpleRoundingMode extends java.lang.Enum<SimpleRoundingMode>
This enum provides a mapping between string representations
and their corresponding BigDecimal rounding modes.
| Enum Constant and Description |
|---|
CEILING
Rounding mode to round towards positive infinity.
|
DOWN
Rounding mode to round towards zero.
|
FLOOR
Rounding mode to round towards negative infinity.
|
HALF_DOWN
Rounding mode to round towards "nearest neighbor"
unless both neighbors are equidistant, in which case round down.
|
HALF_EVEN
Rounding mode to round towards the "nearest neighbor"
unless both neighbors are equidistant, in which case,
round towards the even neighbor.
|
HALF_UP
Rounding mode to round towards "nearest neighbor"
unless both neighbors are equidistant, in which case round up.
|
UP
Rounding mode to round away from zero.
|
| Modifier and Type | Field and Description |
|---|---|
static java.util.Map<java.lang.String,SimpleRoundingMode> |
MODE_MAP
An immutable map of rounding mode names (in uppercase) to their corresponding
SimpleRoundingMode enum values. |
| Modifier and Type | Method and Description |
|---|---|
static SimpleRoundingMode |
fromString(java.lang.String modeString)
Returns the
SimpleRoundingMode associated with the given string representation,
or null if no matching mode is found. |
int |
getMode()
Returns the integer value representing the rounding mode.
|
static SimpleRoundingMode |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static SimpleRoundingMode[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final SimpleRoundingMode FLOOR
BigDecimal.ROUND_FLOOR.public static final SimpleRoundingMode CEILING
BigDecimal.ROUND_CEILING.public static final SimpleRoundingMode DOWN
BigDecimal.ROUND_DOWN.public static final SimpleRoundingMode UP
BigDecimal.ROUND_UP.public static final SimpleRoundingMode HALF_DOWN
BigDecimal.ROUND_HALF_DOWN.public static final SimpleRoundingMode HALF_EVEN
BigDecimal.ROUND_HALF_EVEN.public static final SimpleRoundingMode HALF_UP
BigDecimal.ROUND_HALF_UP.public static final java.util.Map<java.lang.String,SimpleRoundingMode> MODE_MAP
SimpleRoundingMode enum values.
Used for efficient lookup of rounding modes from string representations.public static SimpleRoundingMode[] values()
for (SimpleRoundingMode c : SimpleRoundingMode.values()) System.out.println(c);
public static SimpleRoundingMode valueOf(java.lang.String name)
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic int getMode()
public static SimpleRoundingMode fromString(java.lang.String modeString)
SimpleRoundingMode associated with the given string representation,
or null if no matching mode is found.
The comparison is case-insensitive.modeString - the string representation of the rounding modeSimpleRoundingMode, or null if not foundCopyright © 2000-2025 OAshi S.à r.l. All Rights Reserved.