Here you can find the source of arrayToString(String[] stringArray)
static String arrayToString(String[] stringArray)
//package com.java2s; /* ==================================================================== * * Copyright (C) 2007 - 2015 GeoSolutions S.A.S. * http://www.geo-solutions.it//from w ww . j a v a 2 s . c o m * * GPLv3 + Classpath exception * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. * * ==================================================================== * * This software consists of voluntary contributions made by developers * of GeoSolutions. For more information on GeoSolutions, please see * <http://www.geo-solutions.it/>. * */ public class Main { static String arrayToString(String[] stringArray) { if (stringArray == null) { return "NULL"; } if (stringArray.length == 0) { return "[]"; } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append('['); for (String string : stringArray) { stringBuilder.append(string).append(", "); } stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.length() - 1); stringBuilder.append(']'); return stringBuilder.toString(); } }