Here you can find the source of longArray2Json(long[] array)
static String longArray2Json(long[] array)
//package com.java2s; //License from project: Apache License public class Main { static String longArray2Json(long[] array) { if (array.length == 0) return "[]"; StringBuilder sb = new StringBuilder(array.length << 4); sb.append('['); for (long o : array) { sb.append(Long.toString(o)); sb.append(','); }// ww w .ja v a2 s .co m // set last ',' to ']': sb.setCharAt(sb.length() - 1, ']'); return sb.toString(); } }