Here you can find the source of arr2str(String[] arr)
public static String arr2str(String[] arr) throws Exception
//package com.java2s; /**/*from w ww. j a v a 2 s .c om*/ * Copyright 2014, 2015, 2016 TAIN, Inc. all rights reserved. * * Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.gnu.org/licenses/ * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * ----------------------------------------------------------------- * Copyright 2014, 2015, 2016 TAIN, Inc. * */ public class Main { public static String arr2str(String[] arr) throws Exception { if (arr == null) { return ""; } StringBuffer sb = new StringBuffer(); for (int i = 0; i < arr.length; i++) { if (i > 0) sb.append("|"); sb.append(arr[i]); } return sb.toString(); } }