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 joinArray(int[] arr, String seperator) {
        StringBuilder sb = new StringBuilder();
        for (Integer i : arr) {
            sb.append(i).append(seperator);
        }

        if (sb.length() > 0) {
            return sb.subSequence(0, sb.length() - seperator.length()).toString();
        }
        return sb.toString();
    }
}