Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.ArrayList;

public class Main {
    public static String getCommaSeparatedStringFromArray(ArrayList list) {
        StringBuilder result = new StringBuilder();

        for (int i = 0; i < list.size(); i++) {
            result.append(list.get(i));
            result.append(",");
        }

        return result.length() > 0 ? result.substring(0, result.length() - 1) : "";
    }
}