public class NumberUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static byte |
MAX_INT_DIGITS
The maximal number of digits of an integer value.
|
static byte |
MAX_LONG_DIGITS
The maximal number of digits of a long value.
|
Modifier | Constructor and Description |
---|---|
private |
NumberUtil()
Forbid instances.
|
Modifier and Type | Method and Description |
---|---|
static char |
getAlgebraicSign(int number)
Returns the algebraic sign.
|
static char |
getAlgebraicSign(long number)
Returns the algebraic sign.
|
static byte |
numberOfDigits(int number)
Returns the number of digits of the given number ignoring the algebraic sign (+/-).
|
static byte |
numberOfDigits(long number)
Returns the number of digits of the given number ignoring the algebraic sign (+/-).
|
static int |
parseFullInt(java.lang.String text)
Parses the given full text.
|
static long |
parseFullLong(java.lang.String text)
Parses the given full text.
|
static java.lang.String |
toFullString(int number)
Converts the number into a
String including the algebraic sign
and the maximal number of leading zeros. |
static java.lang.String |
toFullString(long number)
Converts the number into a
String including the algebraic sign
and the maximal number of leading zeros. |
public static final byte MAX_INT_DIGITS
public static final byte MAX_LONG_DIGITS
public static java.lang.String toFullString(int number)
String
including the algebraic sign
and the maximal number of leading zeros.number
- The number to convert.String
.public static java.lang.String toFullString(long number)
String
including the algebraic sign
and the maximal number of leading zeros.number
- The number to convert.String
.public static char getAlgebraicSign(long number)
number
- The number.'+'
for zero and positive numbers, '-'
for negative numbers.public static char getAlgebraicSign(int number)
number
- The number.'+'
for zero and positive numbers, '-'
for negative numbers.public static byte numberOfDigits(int number)
number
- The number to compute the number of its digits.public static byte numberOfDigits(long number)
number
- The number to compute the number of its digits.public static int parseFullInt(java.lang.String text)
text
- The full text.public static long parseFullLong(java.lang.String text)
text
- The full text.