Java Array to String arrayToString(T[] array)

Here you can find the source of arrayToString(T[] array)

Description

array To String

License

Apache License

Declaration

public static <T> String arrayToString(T[] array) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static <T> String arrayToString(T[] array, String splitter) {
        if (array == null)
            return null;
        if (array.length == 0)
            return "";

        StringBuilder stringBuilder = new StringBuilder(array[0].toString());
        for (int i = 1; i < array.length; i++) {
            stringBuilder.append(splitter);
            stringBuilder.append(array[i]);
        }//  w  w w . j  ava 2s .  c  om
        return stringBuilder.toString();
    }

    public static <T> String arrayToString(T[] array) {
        return arrayToString(array, ", ");
    }
}

Related

  1. arrayToString(String[] values)
  2. arrayToString(T[] ar)
  3. arrayToString(T[] array)
  4. arrayToString(T[] array)
  5. arrayToString(T[] array)
  6. arrayToString(T[] array)
  7. arrayToString(T[] array)
  8. arrayToString(T[] array, CharSequence start, CharSequence end)
  9. arrayToString(T[] items, String delimiter)