Java.math Enumeration
is a feature and data type that will have a fixed number of values. For example Number of days in a week, this enumeration in Java was started in JDK 1.5 and it is one of the excellent feature of Java among generics, autoboxing, unboxing. Actually, Enumeration was not available Java, originally it was in C and C++ languages. Java.math Enumeration provides better type safety, it will have methods and constructors. Java Enum has the ability to implement more interfaces, but it cannot extend class why because it internally uses the enum class.
The java.math.RoundingMode
list determines an adjusting conduct for numerical sorts equipped for disposing of precision. Every running mode demonstrates how the slightest huge returned digit of an adjusted result is to be figured. Following is the declaration of the java.math.RoundingMode class.
[java]
public enum RoundingMode
extends Enum<RoundingMode>
[/java]
java.math.RoundingMode Enumeration
.
Constants | Description |
---|---|
CEILING | To round towards positive infinity. |
DOWN | To round towards positive zero. |
FLOOR | To round towards negtive infinity. |
UP | To round away from zero. |
java.math.RoundingMode Enumeration
.
Methods | Description |
---|---|
static RoundingMode valueOf(int rm) | gives back the object of RoundingMode relating to a legacy whole number running mode consistent in BigDecimal. |
static RoundingMode[ ] values() | To give back an array containing the constants of this enum sort. |
static RoundingMode valueOf(String name) | To return the string. |