Java tutorial
//package com.java2s; public class Main { public static String constructIdList(long[] idList) { StringBuilder strBuild = new StringBuilder(""); strBuild.append("["); for (int i = 0; i < idList.length; i++) { if (i != idList.length - 1) { strBuild.append(idList[i]); strBuild.append(","); } else { strBuild.append(idList[i]); } } strBuild.append("]"); // idlist end return strBuild.toString(); } }