Here you can find the source of arrayToCommaString(int[] array)
public static String arrayToCommaString(int[] array)
//package com.java2s; /* ArrayUtil.java 1.0 2010-2-2 * /*from w ww . j av a 2s . c om*/ * Copyright (c) 2010 by Brook Tran * All rights reserved. * * The copyright of this software is own by the authors. * You may not use, copy or modify this software, except * in accordance with the license agreement you entered into * with the copyright holders. For details see accompanying license * terms. */ public class Main { public static String arrayToCommaString(int[] array) { StringBuffer sb = new StringBuffer(); for (int i = array.length - 1; i >= 0; i--) { if (array[i] == 0) { continue; } sb.append(array[i]); sb.append(i == 0 ? "" : ","); } return sb.toString(); } }