Here you can find the source of combine(String[] values, String regex)
public static String combine(String[] values, String regex)
//package com.java2s; //License from project: Open Source License public class Main { public static String combine(String[] values, String regex) { if (values == null) { return null; }/*ww w . ja v a 2 s . c o m*/ StringBuilder sb = new StringBuilder(); for (int i = 0; i < values.length; i++) { if (values[i] == null) { continue; } sb.append(values[i]); if (i < values.length - 1) { sb.append(regex); } } return sb.toString(); } }