public enum NumberSystem extends Enum<NumberSystem>
Defines the number system.
| Enum Constant and Description |
|---|
ARABIC
Arabic numbers with digits 0-9 (default setting).
|
ETHIOPIC
Ethiopic numerals.
|
ROMAN
Roman numerals in range 1-3999.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(char digit)
Does this number system contains given digit char?
|
int |
toInteger(String numeral)
Converts given text numeral to an integer in smart mode.
|
int |
toInteger(String numeral,
Leniency leniency)
Converts given text numeral to an integer.
|
String |
toNumeral(int number)
Converts given integer to a text numeral.
|
static NumberSystem |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static NumberSystem[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final NumberSystem ARABIC
public static final NumberSystem ETHIOPIC
See also A Look at Ethiopic Numerals.
public static final NumberSystem ROMAN
If the leniency is strict then parsing of Roman numerals will only follow modern usage. The parsing is always case-insensitive. See also Roman Numerals.
public static NumberSystem[] values()
for (NumberSystem c : NumberSystem.values()) System.out.println(c);
public static NumberSystem valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic String toNumeral(int number)
Converts given integer to a text numeral.
number - number to be displayed as textIllegalArgumentException - if the conversion is not supported for given numberpublic final int toInteger(String numeral)
Converts given text numeral to an integer in smart mode.
numeral - text numeral to be evaluated as numberNumberFormatException - if given number has wrong formatArithmeticException - if int-range overflowspublic int toInteger(String numeral, Leniency leniency)
Converts given text numeral to an integer.
In most cases, the leniency will not be taken into account, but parsing of some odd roman numerals can be enabled in non-strict mode (for example: IIXX instead of XVIII).
numeral - text numeral to be evaluated as numberleniency - determines how lenient the parsing of given numeral should beNumberFormatException - if given number has wrong formatArithmeticException - if int-range overflowspublic boolean contains(char digit)
Does this number system contains given digit char?
digit - numerical char to be checkedCopyright © 2014–2016. All rights reserved.