public class Conversion
extends java.lang.Object
| Constructor and Description |
|---|
Conversion() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.List<java.lang.Double> |
asList(double[] array)
Copies the content of the specified array into a new list.
|
static java.lang.String |
constructDoubleList(double[] numbers)
convert an array of doubles to a String list
|
static java.lang.String |
constructDoubleList(java.util.List<java.lang.Double> numbers)
convert a list of doubles to a String list
|
static void |
copyTo(double[] original,
java.util.List<java.lang.Double> copy)
Copies the content of the specified double array into a Double list.
|
static void |
dump(byte[] b)
Dump a byte array in a nice format, to System.out.
|
static void |
dump(byte[] b,
int offs,
int len)
Dump a byte array in a nice format, to System.out.
|
static java.lang.String |
escapeNewlines(java.lang.String string)
Escape newlines in the given String.
|
static java.util.List<java.lang.Double> |
parseDouble(java.lang.String text)
Extracts a list of Doubles from a comma-separated string of doubles.
|
static double[] |
parseDoubleList(java.lang.String text)
extract a double array from a string list of doubles.
|
static double[] |
toArray(java.util.List<java.lang.Double> list)
Copies the list values to a new array with the size of the list.
|
static boolean |
toBoolean(java.lang.String str,
boolean defaultValue)
Converts a string boolean to a boolean.
|
static double |
toDouble(java.lang.String str,
double defaultValue)
Convert a stringified double to a double.
|
static float |
toFloat(java.lang.String str,
float defaultValue)
Converts a string float to a float.
|
static int |
toInt(java.lang.String str,
int defaultValue)
Converts a string int to an int.
|
static long |
toLong(java.lang.String str,
long defaultValue)
Converts a string long to a long.
|
static java.lang.String |
unescapeNewlines(java.lang.String string)
Unescape Newlines in the given string.
|
public static double[] parseDoubleList(java.lang.String text)
public static java.util.List<java.lang.Double> parseDouble(java.lang.String text)
text - the String with comma-separated double valuespublic static java.lang.String constructDoubleList(double[] numbers)
public static java.lang.String constructDoubleList(java.util.List<java.lang.Double> numbers)
public static boolean toBoolean(java.lang.String str,
boolean defaultValue)
true, 1, on, yes ... true
false, 0, off, no ... false
If neither of those values is recognized, then the given default value is returned.public static double toDouble(java.lang.String str,
double defaultValue)
Double.parseDouble(java.lang.String), and
returns a default value instead.public static float toFloat(java.lang.String str,
float defaultValue)
Float.parseFloat(java.lang.String), and
returns a default value instead.public static int toInt(java.lang.String str,
int defaultValue)
Integer.parseInt(java.lang.String, int), and
returns a default value instead.public static long toLong(java.lang.String str,
long defaultValue)
Long.parseLong(java.lang.String, int), and
returns a default value instead.public static java.lang.String escapeNewlines(java.lang.String string)
string - The String to escape.public static java.lang.String unescapeNewlines(java.lang.String string)
string - The String to unescape.public static void dump(byte[] b)
b - Byte array to be dumped.public static void dump(byte[] b,
int offs,
int len)
b - Byte array to be dumped.offs - Offset where to start dumping.len - Length of the area to be dumped.public static void copyTo(double[] original,
java.util.List<java.lang.Double> copy)
original - the array to be copiedcopy - the list to be copied intopublic static java.util.List<java.lang.Double> asList(double[] array)
array - the array to be copiedpublic static double[] toArray(java.util.List<java.lang.Double> list)
list - a list with Doubles