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 {
    /**
     * creates a string from an arraylist
     * 
     * @param alValues the values to be concatenated
     * @param strSeparator the separator between one element and the other
     * @return the string with the values seaparated by the strSeparator
     */
    public static String[] getStringArrayFromArrayList(ArrayList<String> alValues) {

        // inits the buffer
        String[] strValues = new String[alValues.size()];

        // cycles on the values of the AL
        for (int j = 0; j < alValues.size(); j++) {

            // appends the j-th vlaur to the buffer
            strValues[j] = alValues.get(j);
        }

        // and returns it
        return strValues;
    }
}