public String formatObj(Object objs) {

        String ans = "";

        final String nlPad;

        // Pad amount changes based on trace format
        if (TraceFormat.ADVANCED.equals(traceFormat)) {
            nlPad = nlAdvancedPadding;
        } else if (TraceFormat.BASIC.equals(traceFormat)) {
            nlPad = nlBasicPadding;
        } else {
            nlPad = nlEnhancedPadding;
        }

        final String nlPadA = nlPad + " ";

        if (objs != null) {
            if (objs.getClass().isArray()) {
                StringBuilder sb = new StringBuilder();
                final int len = Array.getLength(objs);

                if (objs.getClass().getName().equals("[B")) { // Byte array
                    final int COLUMNS = 32;

                    byte b[] = (byte[]) objs;
                    int printLen = len > LoggingConstants.MAX_DATA_LENGTH ? LoggingConstants.MAX_DATA_LENGTH : len;
                    sb.append(nlPad).append(objs.toString()).append(",len=").append(len);

                    for (int i = 0; i < printLen; i++) {
                        if (i % COLUMNS == 0) // offset
                            sb.append(nlPadA + '|' + DataFormatHelper.padHexString(i, 4) + '|');

                        if (i % 4 == 0) // group in words
                            sb.append(" ");

                        sb.append(hexChars[(b[i] >> 4) & 0xF]);
                        sb.append(hexChars[b[i] & 0xF]);
                    }

                    if (printLen != len)
                        sb.append(nlPadA).append(" ...");
                } else if (objs.getClass().getName().equals("[C")) {
                    // Character array - Just print it as a string rather than a single
                    // character on each line
                    sb.append((char[]) objs);
                } else { // not a Byte or char array
                    for (int i = 0; i < len; i++) {
                        String s = formatObj(Array.get(objs, i));
                        if (s.startsWith(LoggingConstants.nl))
                            sb.append(s);
                        else
                            sb.append(nlPad + s);

                        if (sb.length() > LoggingConstants.MAX_DATA_LENGTH) {
                            sb.append(nlPad + "...");
                            break;
                        }
                    }
                }

                ans = sb.toString();
            } else if (objs instanceof Untraceable) {
                ans = nlPad + objs.getClass().getName(); // Use only the class name of the object
            } else if (objs instanceof Traceable) {
                ans = nlPad + formatTraceable((Traceable) objs);
            } else if (objs instanceof TruncatableThrowable) {
                ans = nlPad + DataFormatHelper.throwableToString((TruncatableThrowable) objs);
            } else if (objs instanceof Throwable) {
                ans = nlPad + DataFormatHelper.throwableToString(new TruncatableThrowable((Throwable) objs));
            } else {
                try { // Protect ourselves from badly behaved toString methods
                    ans = nlPad + objs.toString();
                } catch (Exception e) {
                    // No FFDC code needed
                    ans = "<Exception " + e + " caught while calling toString() on object " + objs.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(objs))
                          + ">";
                }
            }
        } else {
            // objs is null - print out "null"
            ans = nlPad + nullParamString;
        }

        return ans;
    }
public String formatObj ( Object objs ) { String ans = "" ; final String nlPad ; if ( TraceFormat . ADVANCED . equals ( traceFormat ) ) { nlPad = nlAdvancedPadding ; } else if ( TraceFormat . BASIC . equals ( traceFormat ) ) { nlPad = nlBasicPadding ; } else { nlPad = nlEnhancedPadding ; } final String nlPadA = nlPad + " " ; if ( objs != null ) { if ( objs . getClass ( ) . isArray ( ) ) { StringBuilder sb = new StringBuilder ( ) ; final int len = Array . getLength ( objs ) ; if ( objs . getClass ( ) . getName ( ) . equals ( "[B" ) ) { final int COLUMNS = 32 ; byte b [ ] = ( byte [ ] ) objs ; int printLen = len > LoggingConstants . MAX_DATA_LENGTH ? LoggingConstants . MAX_DATA_LENGTH : len ; sb . append ( nlPad ) . append ( objs . toString ( ) ) . append ( ",len=" ) . append ( len ) ; for ( int i = 0 ; i < printLen ; i ++ ) { if ( i % COLUMNS == 0 ) sb . append ( nlPadA + '|' + DataFormatHelper . padHexString ( i , 4 ) + '|' ) ; if ( i % 4 == 0 ) sb . append ( " " ) ; sb . append ( hexChars [ ( b [ i ] > > 4 ) & 0xF ] ) ; sb . append ( hexChars [ b [ i ] & 0xF ] ) ; } if ( printLen != len ) sb . append ( nlPadA ) . append ( " ..." ) ; } else if ( objs . getClass ( ) . getName ( ) . equals ( "[C" ) ) { sb . append ( ( char [ ] ) objs ) ; } else { for ( int i = 0 ; i < len ; i ++ ) { String s = formatObj ( Array . get ( objs , i ) ) ; if ( s . startsWith ( LoggingConstants . nl ) ) sb . append ( s ) ; else sb . append ( nlPad + s ) ; if ( sb . length ( ) > LoggingConstants . MAX_DATA_LENGTH ) { sb . append ( nlPad + "..." ) ; break ; } } } ans = sb . toString ( ) ; } else if ( objs instanceof Untraceable ) { ans = nlPad + objs . getClass ( ) . getName ( ) ; } else if ( objs instanceof Traceable ) { ans = nlPad + formatTraceable ( ( Traceable ) objs ) ; } else if ( objs instanceof TruncatableThrowable ) { ans = nlPad + DataFormatHelper . throwableToString ( ( TruncatableThrowable ) objs ) ; } else if ( objs instanceof Throwable ) { ans = nlPad + DataFormatHelper . throwableToString ( new TruncatableThrowable ( ( Throwable ) objs ) ) ; } else { try { ans = nlPad + objs . toString ( ) ; } catch ( Exception e ) { ans = "<Exception " + e + " caught while calling toString() on object " + objs . getClass ( ) . getName ( ) + "@" + Integer . toHexString ( System . identityHashCode ( objs ) ) + ">" ; } } } else { ans = nlPad + nullParamString ; } return ans ; }
Method used to print out traced objects which recognizes and handles arrays and throwables.

@param objs
@return String