Here you can find the source of doubleArray2Json(double[] array)
static String doubleArray2Json(double[] array)
//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(); } }