Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {

    public static String join(String[] strs, String split) {
        StringBuilder sb = new StringBuilder();
        if (strs == null || split == null || strs.length <= 0) {
            return null;
        }

        for (int i = 0, count = strs.length; i < count; i++) {
            sb.append(strs[i]);
            if (i != (count - 1)) {
                sb.append(split);
            }
        }
        return sb.toString();
    }
}