public class Conversions extends Object
Modifier and Type | Method and Description |
---|---|
static int |
fromHex(String hexVal)
Converts a string representing a hexadecimal number to its
integer value.
|
static BigDecimal |
parseBigDecimal(String str)
Attempts to interpret a string as a "BigDecimal" value.
|
static BigInteger |
parseBigInteger(String str)
Attempts to interpret a string as a "BigInteger" value.
|
static byte |
parseByte(String str)
Attempts to interpret a string as a byte (8-bit signed integer) value.
|
static double |
parseDouble(String str)
Attempts to interpret a string as a double (64-bit signed integer) value.
|
static double[] |
parseDoubles(String str)
Attempts to interpret a string as an array of floating point values.
|
static float |
parseFloat(String str)
Attempts to interpret a string as a float (32-bit floating point) value.
|
static int |
parseInt(String str)
Attempts to interpret a string as an int (32-bit signed integer) value.
|
static int[] |
parseInts(String str)
Attempts to interpret a string as an array of integer values.
|
static long |
parseLong(String str)
Attempts to interpret a string as a long (64-bit signed integer) value.
|
static short |
parseShort(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 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 String |
toString(boolean booleanVal)
Turns a boolean value into a string.
|
static String |
toString(byte byteVal)
Turns a byte value into a string.
|
static String |
toString(char charVal)
Turns a single character value into a string.
|
static String |
toString(double fpVal)
Turns a numeric value into a string.
|
static String |
toString(long intVal)
Turns an integer numeric value into a string.
|
static String |
toString(Object objVal)
Turns any object value into a string.
|
public static String toString(double fpVal)
fpVal
- floating point numeric valuefpVal
public static String toString(long intVal)
intVal
- integer numeric valueintVal
public static String toString(char charVal)
charVal
- character numeric valuecharVal
public static String toString(byte byteVal)
byteVal
- byte numeric valuebyteVal
public static String toString(boolean booleanVal)
booleanVal
- boolean value (true or false)booleanVal
("true
" or "false
")public static String toString(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(String str)
str
- string containing numeric representationstr
public static short parseShort(String str)
str
- string containing numeric representationstr
public static int parseInt(String str)
str
- string containing numeric representationstr
public static long parseLong(String str)
str
- string containing numeric representationstr
public static float parseFloat(String str)
str
- string containing numeric representationstr
public static double parseDouble(String str)
str
- string containing numeric representationstr
public static BigInteger parseBigInteger(String str)
The result is a BigInteger
object,
which can't be used in normal numeric expressions, but has a number
of methods defined on it for comparison, arithmetic,
bit manipulation etc.
See the
java.math.BigInteger javadocs for details.
str
- string containing numeric representationstr
public static BigDecimal parseBigDecimal(String str)
The result is a BigDecimal
object,
which can't be used in normal numeric expressions, but has a number
of methods defined on it for comparison, arithmetic,
bit manipulation etc.
See the
java.math.BigDecimal javadocs for details.
str
- string contining numeric representationstr
public static int[] parseInts(String str)
The details of this function's behaviour may change in future releases.
str
- string containing a list of integer valuespublic static double[] parseDoubles(String str)
This function can be used as a hacky way to extract the
numeric values from an STC-S
(for instance ObsCore/EPNcore s_region
) string.
The details of this function's behaviour may change in future releases.
str
- string containing a list of floating point valuespublic 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 String toHex(long value)
value
- integer valuevalue
public static int fromHex(String hexVal)
hexVal
- hexadecimal representation of valuehexVal
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.