public class Conversions
extends java.lang.Object
Modifier and Type | Method | Description |
---|---|---|
static int |
fromHex(java.lang.String hexVal) |
Converts a string representing a hexadecimal number to its
integer value.
|
static byte |
parseByte(java.lang.String str) |
Attempts to interpret a string as a byte (8-bit signed integer) value.
|
static double |
parseDouble(java.lang.String str) |
Attempts to interpret a string as a double (64-bit signed integer) value.
|
static float |
parseFloat(java.lang.String str) |
Attempts to interpret a string as a float (32-bit floating point) value.
|
static int |
parseInt(java.lang.String str) |
Attempts to interpret a string as an int (32-bit signed integer) value.
|
static long |
parseLong(java.lang.String str) |
Attempts to interpret a string as a long (64-bit signed integer) value.
|
static short |
parseShort(java.lang.String str) |
Attempts to interpret a string as a short (16-bit signed integer) value.
|
static byte |
toByte(double value) |
Attempts to convert the numeric argument to a
byte (8-bit signed integer) result.
|
static double |
toDouble(double value) |
Converts the numeric argument to a
double (64-bit signed integer) result.
|
static float |
toFloat(double value) |
Attempts to convert the numeric argument to a
float (32-bit floating point) result.
|
static java.lang.String |
toHex(long value) |
Converts the integer argument to hexadecimal form.
|
static int |
toInteger(double value) |
Attempts to convert the numeric argument to an
int (32-bit signed integer) result.
|
static long |
toLong(double value) |
Attempts to convert the numeric argument to a
long (64-bit signed integer) result.
|
static short |
toShort(double value) |
Attempts to convert the numeric argument to a
short (16-bit signed integer) result.
|
static java.lang.String |
toString(boolean booleanVal) |
Turns a boolean value into a string.
|
static java.lang.String |
toString(byte byteVal) |
Turns a byte value into a string.
|
static java.lang.String |
toString(char charVal) |
Turns a single character value into a string.
|
static java.lang.String |
toString(double fpVal) |
Turns a numeric value into a string.
|
static java.lang.String |
toString(long intVal) |
Turns an integer numeric value into a string.
|
static java.lang.String |
toString(java.lang.Object objVal) |
Turns any object value into a string.
|
public static java.lang.String toString(double fpVal)
fpVal
- floating point numeric valuefpVal
public static java.lang.String toString(long intVal)
intVal
- integer numeric valueintVal
public static java.lang.String toString(char charVal)
charVal
- character numeric valuecharVal
public static java.lang.String toString(byte byteVal)
byteVal
- byte numeric valuebyteVal
public static java.lang.String toString(boolean booleanVal)
booleanVal
- boolean value (true or false)booleanVal
("true
" or "false
")public static java.lang.String toString(java.lang.Object objVal)
toString
to any object value without knowing its type
and get a useful return from it.objVal
- non-primitive valueobjVal
public static byte parseByte(java.lang.String str)
str
- string containing numeric representationstr
public static short parseShort(java.lang.String str)
str
- string containing numeric representationstr
public static int parseInt(java.lang.String str)
str
- string containing numeric representationstr
public static long parseLong(java.lang.String str)
str
- string containing numeric representationstr
public static float parseFloat(java.lang.String str)
str
- string containing numeric representationstr
public static double parseDouble(java.lang.String str)
str
- string containing numeric representationstr
public static byte toByte(double value)
value
- numeric value for conversionvalue
converted to type bytepublic static short toShort(double value)
value
- numeric value for conversionvalue
converted to type shortpublic static int toInteger(double value)
value
- numeric value for conversionvalue
converted to type intpublic static long toLong(double value)
value
- numeric value for conversionvalue
converted to type longpublic static float toFloat(double value)
value
- numeric value for conversionvalue
converted to type floatpublic static double toDouble(double value)
value
- numeric value for conversionvalue
converted to type doublepublic static java.lang.String toHex(long value)
value
- integer valuevalue
toHex(42) = "2a"
public static int fromHex(java.lang.String hexVal)
hexVal
- hexadecimal representation of valuehexVal
fromHex("2a") = 42
Copyright © 2018 Central Laboratory of the Research Councils. All Rights Reserved.