Here you can find the source of intArray2Json(int[] array)
static String intArray2Json(int[] array)
//package com.java2s; //License from project: Apache License public class Main { static String intArray2Json(int[] array) { if (array.length == 0) return "[]"; StringBuilder sb = new StringBuilder(array.length << 4); sb.append('['); for (int o : array) { sb.append(Integer.toString(o)); sb.append(','); }/*from w ww . j ava 2 s.c o m*/ // set last ',' to ']': sb.setCharAt(sb.length() - 1, ']'); return sb.toString(); } }