Java Double Array Create doubleArray2Json(double[] array)

Here you can find the source of doubleArray2Json(double[] array)

Description

double Array Json

License

Apache License

Declaration

static String doubleArray2Json(double[] array) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    static String doubleArray2Json(double[] array) {
        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(',');
        }/*  w w  w. j av  a2s  . c om*/
        // set last ',' to ']':
        sb.setCharAt(sb.length() - 1, ']');
        return sb.toString();
    }
}

Related

  1. doubleArray(Double... elements)
  2. doubleArray(int... in)
  3. doubleArray(String data)
  4. doubleArrayFromString(final String data)
  5. doubleArrayFromString(String record)
  6. doubleArraySize(byte[] array)
  7. toDoubleA(byte[] data)