commons-file/src/main/java/info/monitorenter/util/StringUtil.java
public static final String arrayToString(final Object isArr, final String separator) {
    String result;
    if (isArr == null) {
      result = "null";
    } else {
      Object element;
      StringBuffer tmp = new StringBuffer();
      try {
        int length = Array.getLength(isArr);
        tmp.append("[");
        for (int i = 0; i < length; i++) {
          element = Array.get(isArr, i);
          if (element == null) {
            tmp.append("null");
          } else {
            tmp.append(element.toString());
          }
          if (i < length - 1) {
            tmp.append(separator);
          }
        }
        tmp.append("]");
        result = tmp.toString();
      } catch (ArrayIndexOutOfBoundsException bound) {
        // programming mistake or bad Array.getLength(obj).
        tmp.append("]");
        result = tmp.toString();

      } catch (IllegalArgumentException noarr) {
        result = isArr.toString();
      }
    }
    return result;
  }
public static final String arrayToString(final Object isArr, final String separator) {
    String result;
    if (isArr == null) {
      result = "null";
    } else {
      Object element;
      StringBuffer tmp = new StringBuffer();
      try {
        int length = Array.getLength(isArr);
        tmp.append("[");
        for (int i = 0; i < length; i++) {
          element = Array.get(isArr, i);
          if (element == null) {
            tmp.append("null");
          } else {
            tmp.append(element.toString());
          }
          if (i < length - 1) {
            tmp.append(separator);
          }
        }
        tmp.append("]");
        result = tmp.toString();
      } catch (ArrayIndexOutOfBoundsException bound) {
        // programming mistake or bad Array.getLength(obj).
        tmp.append("]");
        result = tmp.toString();

      } catch (IllegalArgumentException noarr) {
        result = isArr.toString();
      }
    }
    return result;
  }
public static final String arrayToString ( final Object isArr , final String separator ) { String result ; if ( isArr == null ) { result = "null" ; } else { Object element ; StringBuffer tmp = new StringBuffer ( ) ; try { int length = Array . getLength ( isArr ) ; tmp . append ( "[" ) ; for ( int i = 0 ; i < length ; i ++ ) { element = Array . get ( isArr , i ) ; if ( element == null ) { tmp . append ( "null" ) ; } else { tmp . append ( element . toString ( ) ) ; } if ( i < length - 1 ) { tmp . append ( separator ) ; } } tmp . append ( "]" ) ; result = tmp . toString ( ) ; } catch ( ArrayIndexOutOfBoundsException bound ) { // programming mistake or bad Array.getLength(obj). tmp . append ( "]" ) ; result = tmp . toString ( ) ; } catch ( IllegalArgumentException noarr ) { result = isArr . toString ( ) ; } } return result ; }
If the given Object is no Array, it's toString - method is invoked.
Primitive type - Arrays and Object - Arrays are introspected using
java.lang.reflect.Array. Convention for creation for String -
representation: <br>

<code>
// Primitive arrays:
&quot;[&quot;+isArr[0]+&quot;&lt;separator&gt;&quot;+isArr[1]+.. ..+isArr[isArr.length-1]+&quot;]&quot;


//Object arrays :
&quot;[&quot;+isArr[0].toString()+&quot;&lt;separator&gt;&quot;+.. ..+isArr[isArr.length-1].toString+&quot;]&quot;
// Two or three - dimensional Arrays are not supported
//(should be reflected in a special output method, e.g.as a field)

// other Objects:
toString()
</code>

@param separator put in-between each array element in the resulting string.

@param isArr
The Array to represent as String.

@return a String-representation of the Object.
If the given Object is no Array it s toString - method is invoked . Primitive type - Arrays and Object - Arrays are introspected using java . lang . reflect . Array . Convention for creation for String - representation : <br >