Here you can find the source of arr2str(String[] arr, String sep)
public static String arr2str(String[] arr, String sep)
//package com.java2s; public class Main { public static String arr2str(String[] arr, String sep) { if (arr.length > 0) { StringBuffer sb = new StringBuffer(); for (String s : arr) { sb.append(s).append(sep); }//from w ww .ja v a 2 s . c o m return sb.toString().substring(0, sb.toString().lastIndexOf(sep)); } else { return null; } } }