Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**
     * For logging.
     *
     * @param arr
     * @return
     */
    public static <T> String array2str(T[] arr) {
        StringBuilder sb = new StringBuilder("[");
        try {
            if (arr != null && arr.length > 0) {
                for (T elem : arr) {
                    sb.append(elem.toString()).append(", ");
                }
                sb.delete(sb.length() - 2, sb.length());
            }
            sb.append("]");
        } catch (Exception e) {
        }
        return sb.toString();
    }
}