public class Convert extends Object
Modifier and Type | Field and Description |
---|---|
static int |
FORMAT_UNSIGNED
This is an option for formatInt and formatLong.
|
static int |
FORMAT_UPPERCASE
This is an option for formatXXX.
|
Modifier | Constructor and Description |
---|---|
protected |
Convert() |
Modifier and Type | Method and Description |
---|---|
static String |
formatDouble(double value)
Convert a double value into a String of characters.
|
static int |
formatDouble(double value,
char[] dest,
int offset)
Convert a double value into a String of characters or calculate the number of characters needed
to convert the integer into the String of characters.
|
static int |
formatDouble(double value,
char[] dest,
int offset,
int options)
Convert a double value into a String of characters or calculate the number of characters needed
to convert the long into the String of characters.
|
static String |
formatInt(int value)
Convert an integer into a String of characters.
|
static int |
formatInt(int value,
char[] dest,
int offset)
Convert an integer into a String of characters or calculate the number of characters needed
to convert the integer into the String of characters.
|
static int |
formatInt(int value,
char[] dest,
int offset,
int radix,
int options)
Convert an integer into a String of characters or calculate the number of characters needed
to convert the integer into the String of characters.
|
static String |
formatInt(int value,
int radix)
Convert an integer into a String of characters.
|
static String |
formatLong(long value)
Convert a long value into a String of characters.
|
static int |
formatLong(long value,
char[] dest,
int offset)
Convert a long value into a String of characters or calculate the number of characters needed
to convert the integer into the String of characters.
|
static int |
formatLong(long value,
char[] dest,
int offset,
int radix,
int options)
Convert a long value into a String of characters or calculate the number of characters needed
to convert the long into the String of characters.
|
static String |
formatLong(long value,
int radix)
Convert a long value into a String of characters.
|
static String |
intToHexString(int value)
Convert the value to an unsigned hex string.
|
static String |
longToHexString(long value)
Convert the value to an unsigned hex string.
|
static double |
parseDouble(char[] chars,
int offset,
int length)
Parse a double precision floating point decimal number.
|
static double |
parseDouble(String value)
Parse a double precision floating point decimal number.
|
static int |
parseInt(char[] str,
int offset,
int length,
int radix)
Convert a String to an integer using the specified radix.
|
static int |
parseInt(String str)
Convert a String to an integer.
|
static int |
parseInt(String str,
int radix)
Convert a String to an integer using the specified radix.
|
static long |
parseLong(char[] str,
int offset,
int length,
int radix)
Convert a String to an integer using the specified radix.
|
static long |
parseLong(String str)
Convert a String to a long value.
|
static long |
parseLong(String str,
int radix)
Convert a String to a long value using the specified radix.
|
static boolean |
toBoolean(String s)
Convert the string to a boolean.
|
static char |
toChar(String s) |
static double |
toDouble(char[] chars,
int start,
int length) |
static double |
toDouble(String s) |
static double |
toDoubleBitwise(long l) |
static float |
toFloat(char[] chars,
int start,
int length) |
static float |
toFloat(String s) |
static float |
toFloatBitwise(int i)
Converts the given IEEE 754 bit representation of a float to a float.
|
static int |
toInt(char[] chars,
int start,
int length) |
static int |
toInt(String s)
Converts the given String to an int.
|
static int |
toIntBitwise(float f)
Converts the given float to its bit representation in IEEE 754 format.
|
static int |
toIntBitwise(float f,
boolean rawBits)
Get the 32-bit bitwise equivalent of the float value.
|
static long |
toLong(char[] chars,
int start,
int length) |
static long |
toLong(String s) |
static long |
toLongBitwise(double d) |
static long |
toLongBitwise(double d,
boolean rawBits)
Get the 64-bit bitwise equivalent of the double value.
|
static String |
toString(boolean b)
Converts the given boolean to a String.
|
static String |
toString(char c)
Converts the given char to a String.
|
static String |
toString(double d) |
static String |
toString(float f)
Converts the given float to a String.
|
static String |
toString(int i)
Converts the given int to a String.
|
static String |
toString(long l) |
public static final int FORMAT_UNSIGNED
public static final int FORMAT_UPPERCASE
public static int toInt(String s)
public static String toString(boolean b)
public static String toString(char c)
public static int toIntBitwise(float f)
public static float toFloatBitwise(int i)
public static long toLongBitwise(double d)
public static double toDoubleBitwise(long l)
public static long toLongBitwise(double d, boolean rawBits)
d
- the double value.rawBits
- true if you want the raw bits, false to convert all NaN values
into a single standard NaN value.public static int toIntBitwise(float f, boolean rawBits)
f
- the float value.rawBits
- true if you want the raw bits, false to convert all NaN values
into a single standard NaN value.public static String toString(float f)
public static String toString(int i)
public static float toFloat(String s)
public static boolean toBoolean(String s)
public static char toChar(String s)
public static String toString(double d)
public static String toString(long l)
public static double toDouble(String s)
public static long toLong(String s)
public static int toInt(char[] chars, int start, int length)
public static float toFloat(char[] chars, int start, int length)
public static double toDouble(char[] chars, int start, int length)
public static long toLong(char[] chars, int start, int length)
public static int parseInt(char[] str, int offset, int length, int radix) throws NumberFormatException
str
- The characters to parse.offset
- The index of the first character to parse.length
- The number of characters to parse.radix
- The radix ( >1 and < 37 )NumberFormatException
- if the String value is not a parsable integer.IllegalArgumentException
- if the radix is not in the correct range.public static long parseLong(char[] str, int offset, int length, int radix) throws NumberFormatException
str
- The characters to parse.offset
- The index of the first character to parse.length
- The number of characters to parse.radix
- The radix ( >1 and < 37 )NumberFormatException
- if the String value is not a parsable integer.IllegalArgumentException
- if the radix is not in the correct range.public static int parseInt(String str) throws NumberFormatException
str
- The characters to parse.NumberFormatException
- if the String value is not a parsable integer.public static int parseInt(String str, int radix)
str
- The characters to parse.radix
- The radix ( >1 and < 37 )NumberFormatException
- if the String value is not a parsable integer.IllegalArgumentException
- if the radix is not in the correct range.public static long parseLong(String str) throws NumberFormatException
str
- The characters to parse.NumberFormatException
- if the String value is not a parsable integer.public static long parseLong(String str, int radix)
str
- The characters to parse.radix
- The radix ( >1 and < 37 )NumberFormatException
- if the String value is not a parsable integer.IllegalArgumentException
- if the radix is not in the correct range.public static double parseDouble(char[] chars, int offset, int length) throws NumberFormatException
chars
- The characters to parse.offset
- The index of the first character.length
- The number of characters to parse.NumberFormatException
- if the string is not parsable.public static double parseDouble(String value) throws NumberFormatException
value
- The characters to parse.NumberFormatException
- if the string is not parsable.public static int formatInt(int value, char[] dest, int offset, int radix, int options)
value
- the value to convert.dest
- the destination character array. If this is null theoffset
- the start index in the character array.radix
- the radix (>1 and <37).options
- a combination of the FORMAT_XXX options.IllegalArgumentException
- if the radix is not in the correct range.public static int formatInt(int value, char[] dest, int offset)
value
- the value to convert.dest
- the destination character array. If this is null theoffset
- the start index in the character array.public static String formatInt(int value, int radix)
value
- the value to convert.radix
- the radix (>1 and <37).IllegalArgumentException
- if the radix is not in the correct range.public static String formatInt(int value)
value
- the value to convert.public static int formatLong(long value, char[] dest, int offset, int radix, int options)
value
- the value to convert.dest
- the destination character array. If this is null theoffset
- the start index in the character array.radix
- the radix (>1 and <37).options
- a combination of the FORMAT_XXX options.IllegalArgumentException
- if the radix is not in the correct range.public static int formatLong(long value, char[] dest, int offset)
value
- the value to convert.dest
- the destination character array. If this is null theoffset
- the start index in the character array.public static String formatLong(long value, int radix)
value
- the value to convert.radix
- the radix (>1 and <37).IllegalArgumentException
- if the radix is not in the correct range.public static String formatLong(long value)
value
- the value to convert.public static int formatDouble(double value, char[] dest, int offset, int options)
value
- the value to convert.dest
- the destination character array. If this is null theoffset
- the start index in the character array.options
- a combination of the FORMAT_XXX options.public static int formatDouble(double value, char[] dest, int offset)
value
- the value to convert.dest
- the destination character array. If this is null theoffset
- the start index in the character array.public static String formatDouble(double value)
value
- the value to convert.radix
- the radix (>1 and <37).IllegalArgumentException
- if the radix is not in the correct range.public static String intToHexString(int value)
public static String longToHexString(long value)