Java Array to String arrayToString(T[] array)

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

Description

array To String

License

Open Source License

Declaration

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

Method Source Code

//package com.java2s;

public class Main {
    public static <T> String arrayToString(T[] array) {
        if (array != null) {
            StringBuilder builder = new StringBuilder();
            for (int i = 0; i < array.length; i++) {
                Object object = (Object) array[i];
                builder.append(String.valueOf(object));
                if (i < array.length - 1) {
                    builder.append(", ");
                }//from   www . j  a  v  a2s  . c  o m
            }
            return builder.toString();
        } else {
            return "" + null;
        }
    }
}

Related

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