Java Array to String arrayToString(Object[] objs, String separator)

Here you can find the source of arrayToString(Object[] objs, String separator)

Description

array To String

License

Open Source License

Declaration

public static String arrayToString(Object[] objs, String separator) 

Method Source Code

//package com.java2s;

public class Main {
    public static String arrayToString(Object[] objs, String separator) {
        if (objs == null) {
            return "[null]";
        }//from  www .j a  va 2  s . co  m

        StringBuffer result = new StringBuffer();
        if (objs.length > 0) {
            result.append(objs[0] != null ? objs[0].toString() : objs[0]);
            for (int i = 1; i < objs.length; i++) {
                result.append(separator);
                result.append(objs[i] != null ? objs[i].toString()
                        : objs[i]);
            }
        }
        return result.toString();
    }

    public static String arrayToString(Object[] objs) {
        final String separator = ", ";
        return arrayToString(objs, separator);
    }
}

Related

  1. arrayToString(Object[] objects)
  2. arrayToString(Object[] objects)
  3. arrayToString(Object[] objs)
  4. arrayToString(Object[] objs)
  5. arrayToString(Object[] objs, boolean stripPackageNames)
  6. ArrayToString(Object[] row, StringBuilder sbf)
  7. arrayToString(Object[] subject)
  8. arrayToString(String array[], String separator)
  9. arrayToString(String format, double[] array)