public static class BTraceUtils.Numbers
extends java.lang.Object
Constructor and Description |
---|
Numbers() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Boolean |
box(boolean b)
Returns a Boolean instance representing the specified
boolean value.
|
static java.lang.Byte |
box(byte b)
Returns a Byte instance representing the specified
byte value.
|
static java.lang.Character |
box(char c)
Returns a Character instance representing the specified
char value.
|
static java.lang.Double |
box(double d)
Returns a Double instance representing the specified
double value.
|
static java.lang.Float |
box(float f)
Returns a Float instance representing the specified
float value.
|
static java.lang.Integer |
box(int i)
Returns a Integer instance representing the specified
int value.
|
static java.lang.Long |
box(long l)
Returns a Long instance representing the specified
long value.
|
static java.lang.Short |
box(short s)
Returns a Short instance representing the specified
short value.
|
static double |
exp(double a)
Returns Euler's number e raised to the power of a
double value. |
static boolean |
isInfinite(double d)
Returns
true if the specified number is infinitely
large in magnitude, false otherwise. |
static boolean |
isInfinite(float f)
Returns
true if the specified number is infinitely
large in magnitude, false otherwise. |
static boolean |
isNaN(double d)
Returns
true if the specified number is a
Not-a-Number (NaN) value, false otherwise. |
static boolean |
isNaN(float f)
Returns
true if the specified number is a
Not-a-Number (NaN) value, false otherwise. |
static double |
log(double a)
Returns the natural logarithm (base e) of a
double
value. |
static double |
log10(double a)
Returns the base 10 logarithm of a
double value. |
static boolean |
parseBoolean(java.lang.String s)
Parses the string argument as a boolean.
|
static byte |
parseByte(java.lang.String s)
Parses the string argument as a signed decimal
byte . |
static double |
parseDouble(java.lang.String s)
Returns a new
double initialized to the value
represented by the specified String , as performed
by the valueOf methcod of class
Double . |
static float |
parseFloat(java.lang.String s)
Returns a new
float initialized to the value
represented by the specified String , as performed
by the valueOf method of class Float . |
static int |
parseInt(java.lang.String s)
Parses the string argument as a signed decimal integer.
|
static long |
parseLong(java.lang.String s)
Parses the string argument as a signed decimal
long . |
static short |
parseShort(java.lang.String s)
Parses the string argument as a signed decimal
short . |
static double |
random()
Returns a
double value with a positive sign, greater
than or equal to 0.0 and less than 1.0 . |
static boolean |
unbox(java.lang.Boolean b)
Returns the value of the given Boolean object as a boolean
primitive.
|
static byte |
unbox(java.lang.Byte b)
Returns the value of the specified Byte as a
byte . |
static char |
unbox(java.lang.Character ch)
Returns the value of the given Character object as a char
primitive.
|
static double |
unbox(java.lang.Double d)
Returns the double value represented by the specified
Double . |
static float |
unbox(java.lang.Float f)
Returns the float value represented by the specified
Float . |
static int |
unbox(java.lang.Integer i)
Returns the value of represented by
Integer . |
static long |
unbox(java.lang.Long l)
Returns the long value represented by the specified
Long . |
static short |
unbox(java.lang.Short s)
Returns the short value represented by
Short . |
public static double random()
double
value with a positive sign, greater
than or equal to 0.0
and less than 1.0
.
Returned values are chosen pseudorandomly with (approximately)
uniform distribution from that range.public static double log(double a)
double
value. Special cases:
The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.
a
- a valuea
, the natural logarithm of
a
.public static double log10(double a)
double
value.
Special cases:
The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.
a
- a valuea
.public static double exp(double a)
double
value. Special cases:
The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.
a
- the exponent to raise e to.a
,
where e is the base of the natural logarithms.public static boolean isNaN(double d)
true
if the specified number is a
Not-a-Number (NaN) value, false
otherwise.d
- the value to be tested.true
if the value of the argument is NaN;
false
otherwise.public static boolean isNaN(float f)
true
if the specified number is a
Not-a-Number (NaN) value, false
otherwise.f
- the value to be tested.true
if the value of the argument is NaN;
false
otherwise.public static boolean isInfinite(double d)
true
if the specified number is infinitely
large in magnitude, false
otherwise.d
- the value to be tested.true
if the value of the argument is positive
infinity or negative infinity; false
otherwise.public static boolean isInfinite(float f)
true
if the specified number is infinitely
large in magnitude, false
otherwise.f
- the value to be tested.true
if the value of the argument is positive
infinity or negative infinity; false
otherwise.public static boolean parseBoolean(java.lang.String s)
boolean
returned represents the value true
if the string argument
is not null
and is equal, ignoring case, to the string
"true"
.
Example: Boolean.parseBoolean("True")
returns true.
Example: Boolean.parseBoolean("yes")
returns false.
s
- the String
containing the boolean
representation to be parsedpublic static byte parseByte(java.lang.String s)
byte
. The characters in the string must all be
decimal digits, except that the first character may be an ASCII
minus sign '-'
('\u002D'
) to
indicate a negative value. The resulting byte
value is
returned.s
- a String
containing the
byte
representation to be parsedbyte
value represented by the
argument in decimalpublic static short parseShort(java.lang.String s)
short
. The characters in the string must all be
decimal digits, except that the first character may be an ASCII
minus sign '-'
('\u002D'
) to
indicate a negative value. The resulting short
value is
returned.s
- a String
containing the short
representation to be parsedshort
value represented by the
argument in decimal.public static int parseInt(java.lang.String s)
'-'
('\u002D'
) to indicate a negative value. The resulting
integer value is returned.s
- a String
containing the int
representation to be parsedpublic static long parseLong(java.lang.String s)
long
. The characters in the string must all be
decimal digits, except that the first character may be an ASCII
minus sign '-'
(\u002D'
) to
indicate a negative value. The resulting long
value is returned.
Note that neither the character L
('\u004C'
) nor l
('\u006C'
) is permitted to appear at the end
of the string as a type indicator, as would be permitted in
Java programming language source code.
s
- a String
containing the long
representation to be parsedlong
represented by the argument in
decimal.public static float parseFloat(java.lang.String s)
float
initialized to the value
represented by the specified String
, as performed
by the valueOf
method of class Float
.s
- the string to be parsed.float
value represented by the string
argument.public static double parseDouble(java.lang.String s)
double
initialized to the value
represented by the specified String
, as performed
by the valueOf
methcod of class
Double
.s
- the string to be parsed.double
value represented by the string
argument.public static java.lang.Boolean box(boolean b)
b
- a boolean value.public static java.lang.Character box(char c)
c
- a char value.public static java.lang.Byte box(byte b)
b
- a byte value.public static java.lang.Short box(short s)
s
- a short value.public static java.lang.Integer box(int i)
i
- an int
value.public static java.lang.Long box(long l)
l
- a long value.public static java.lang.Float box(float f)
f
- a float value.public static java.lang.Double box(double d)
d
- a double value.public static boolean unbox(java.lang.Boolean b)
b
- the Boolean object whose value is returned.boolean
value of the object.public static char unbox(java.lang.Character ch)
ch
- the Character object whose value is returned.char
value of the object.public static byte unbox(java.lang.Byte b)
byte
.b
- Byte that is unboxedByte
.public static short unbox(java.lang.Short s)
Short
.s
- Short that is unboxed.Short
.public static int unbox(java.lang.Integer i)
Integer
.i
- Integer that is unboxed.Integer
.public static long unbox(java.lang.Long l)
Long
.l
- Long to be unboxed.Long
.public static float unbox(java.lang.Float f)
Float
.f
- Float to be unboxed.Float
.public static double unbox(java.lang.Double d)
Double
.d
- Double to be unboxed.