Java Utililty Methods Array to String

List of utility methods to do Array to String

Description

The list of methods to do Array to String are organized into topic(s).

Method

StringarrayToString(Object array)
array To String
if (array instanceof byte[])
    return arrayToString((byte[]) array);
if (array instanceof short[])
    return arrayToString((short[]) array);
if (array instanceof int[])
    return arrayToString((int[]) array);
if (array instanceof long[])
    return arrayToString((long[]) array);
...
StringarrayToString(Object obj)
array To String
if (null == obj) {
    return null;
if (isArray(obj)) {
    try {
        return Arrays.deepToString((Object[]) obj);
    } catch (Exception e) {
        final String className = obj.getClass().getComponentType().getName();
...
StringarrayToString(Object obj[])
array To String
StringBuilder sb = new StringBuilder();
for (int i = 0; i < obj.length; i++) {
    sb.append("GenericUtil: printArray: Index " + i + ": " + obj[i] + "\n");
return sb.toString();
StringarrayToString(Object... keys)
array To String
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < keys.length; i++) {
    buffer.append(keys[i]);
    if (i != keys.length - 1) {
        buffer.append(",");
return buffer.toString();
...
StringarrayToString(Object... objects)
Convert the specified parameters into a string.
if (objects == null)
    return "";
StringBuilder sb = new StringBuilder();
for (Object o : objects) {
    sb.append(o).append(", ");
if (sb.length() <= 2) {
    return "";
...
StringarrayToString(Object[] a)
array To String
if (a == null)
    return "null";
int iMax = a.length - 1;
if (iMax == -1)
    return "";
StringBuilder b = new StringBuilder();
for (int i = 0;; i++) {
    b.append(String.valueOf(a[i]));
...
StringarrayToString(Object[] anArray, String aPrefix, String aSeparator, String aSuffix, String anEscapeChars, char anEscapeSymbol)
array To String
if (aPrefix == null)
    aPrefix = "";
if (aSeparator == null)
    aSeparator = " ";
if (aSuffix == null)
    aSuffix = "";
if (anArray == null || anArray.length == 0)
    return aPrefix + aSuffix;
...
StringarrayToString(Object[] args, String separator)
array To String
if (args == null || separator == null) {
    return null;
StringBuffer result = new StringBuffer();
if (args.length > 0) {
    result.append(args[0]);
    for (int i = 1; i < args.length; i++) {
        result.append(separator);
...
StringarrayToString(Object[] arr)
array To String
if (arr == null) {
    return "<<NULL>>";
} else {
    StringBuilder sb = new StringBuilder();
    sb.append("[");
    for (int i = 0; i < arr.length; i++) {
        Object elem = arr[i];
        sb.append(elem.toString());
...
StringarrayToString(Object[] arr)
array To String
return collectionToString(Arrays.asList(arr));