Java Utililty Methods Double Array Create

List of utility methods to do Double Array Create

Description

The list of methods to do Double Array Create are organized into topic(s).

Method

double[]doubleArray(Double... elements)
double Array
double array[] = new double[elements.length];
for (int i = 0; i < elements.length; i++) {
    array[i] = elements[i];
return array;
StringdoubleArray(int... in)
double Array
String out = "[ ";
for (int d : in) {
    out += (d + " , ");
out = out.substring(0, out.length() - 2 > 0 ? out.length() - 2 : 2);
return out + "]";
double[]doubleArray(String data)
double Array
if (data == null || data.equals(""))
    return new double[0];
String[] split = data.split(" ");
double[] r = new double[split.length];
for (int i = 0; i < r.length; i++) {
    try {
        r[i] = Double.parseDouble(split[i]);
    } catch (NumberFormatException e) {
...
StringdoubleArray2Json(double[] array)
double Array Json
if (array.length == 0)
    return "[]";
StringBuilder sb = new StringBuilder(array.length << 4);
sb.append('[');
for (double o : array) {
    sb.append(Double.toString(o));
    sb.append(',');
sb.setCharAt(sb.length() - 1, ']');
return sb.toString();
double[]doubleArrayFromString(final String data)
double Array From String
final double[] result;
if (data.equals(CONFIG_EMPTY)) {
    result = null;
} else {
    final String[] split = data.split(CONFIG_SEPARATOR_ARRAY);
    result = new double[split.length];
    for (int i = 0; i < split.length; i++) {
        result[i] = Double.valueOf(split[i].trim());
...
double[]doubleArrayFromString(String record)
double Array From String
return doubleArrayFromString(record, DEF_FIELD_DELIM);
byte[]doubleArraySize(byte[] array)
double Array Size
byte[] temp = new byte[array.length * 2];
System.arraycopy(array, 0, temp, 0, array.length);
return temp;
double[]toDoubleA(byte[] data)
to Double A
if (data == null)
    return null;
if (data.length % 8 != 0)
    return null;
double[] dbls = new double[data.length / 8];
for (int i = 0; i < dbls.length; i++) {
    dbls[i] = toDouble(new byte[] { data[(i * 8)], data[(i * 8) + 1], data[(i * 8) + 2], data[(i * 8) + 3],
            data[(i * 8) + 4], data[(i * 8) + 5], data[(i * 8) + 6], data[(i * 8) + 7], });
...
double[]toDoubleArr(short[] arr)
to Double Arr
double[] dArr = new double[arr.length];
for (int i = 0; i < arr.length; i++) {
    dArr[i] = (double) arr[i];
return dArr;
double[]toDoubleArray(boolean[] array)
Coverts given booleans array to array of doubles.
double[] result = new double[array.length];
for (int i = 0; i < array.length; i++) {
    result[i] = array[i] ? 1 : 0;
return result;