base/struts-tools/src/main/com/thesett/common/webapp/tags/DebugTag.java
private String toStringValue(Object value)
    {
        // Check if the value is null
        if (value == null)
        {
            return "null";
        }

        StringBuffer sb = new StringBuffer();

        Class type = value.getClass();

        if (type.isArray())
        {
            Class componentType = type.getComponentType();

            sb.append(componentType.getName());
            sb.append("[]: {");

            if (!componentType.isPrimitive())
            {
                Object[] arr = (Object[]) value;

                for (int i = 0; i < arr.length; i++)
                {
                    if (i != 0)
                    {
                        sb.append(", ");
                    }

                    sb.append(arr[i]);
                }
            }
            else if (componentType == Boolean.TYPE)
            {
                boolean[] arr = (boolean[]) value;

                for (int i = 0; i < arr.length; i++)
                {
                    if (i != 0)
                    {
                        sb.append(", ");
                    }

                    sb.append(arr[i]);
                }
            }
            else if (componentType == Byte.TYPE)
            {
                byte[] arr = (byte[]) value;

                for (int i = 0; i < arr.length; i++)
                {
                    if (i != 0)
                    {
                        sb.append(", ");
                    }

                    sb.append(arr[i]);
                }
            }
            else if (componentType == Character.TYPE)
            {
                char[] arr = (char[]) value;

                for (int i = 0; i < arr.length; i++)
                {
                    if (i != 0)
                    {
                        sb.append(", ");
                    }

                    sb.append(arr[i]);
                }
            }
            else if (componentType == Double.TYPE)
            {
                double[] arr = (double[]) value;

                for (int i = 0; i < arr.length; i++)
                {
                    if (i != 0)
                    {
                        sb.append(", ");
                    }

                    sb.append(arr[i]);
                }
            }
            else if (componentType == Float.TYPE)
            {
                float[] arr = (float[]) value;

                for (int i = 0; i < arr.length; i++)
                {
                    if (i != 0)
                    {
                        sb.append(", ");
                    }

                    sb.append(arr[i]);
                }
            }
            else if (componentType == Integer.TYPE)
            {
                int[] arr = (int[]) value;

                for (int i = 0; i < arr.length; i++)
                {
                    if (i != 0)
                    {
                        sb.append(", ");
                    }

                    sb.append(arr[i]);
                }
            }
            else if (componentType == Long.TYPE)
            {
                long[] arr = (long[]) value;

                for (int i = 0; i < arr.length; i++)
                {
                    if (i != 0)
                    {
                        sb.append(", ");
                    }

                    sb.append(arr[i]);
                }
            }
            else if (componentType == Short.TYPE)
            {
                short[] arr = (short[]) value;

                for (int i = 0; i < arr.length; i++)
                {
                    if (i != 0)
                    {
                        sb.append(", ");
                    }

                    sb.append(arr[i]);
                }
            }

            sb.append("}");
        }
        else
        {
            // Obtain the objects value using toString, but protect this against null pointer exceptions, to harden
            // this implementation.
            String stringValue = null;

            try
            {
                stringValue = value.toString();
            }
            catch (NullPointerException e)
            {
                stringValue = "";
            }

            sb.append(value.getClass().getName()).append(": ").append(stringValue);
        }

        return sb.toString();
    }
private String toStringValue(Object value)
    {
        // Check if the value is null
        if (value == null)
        {
            return "null";
        }

        StringBuffer sb = new StringBuffer();

        Class type = value.getClass();

        if (type.isArray())
        {
            Class componentType = type.getComponentType();

            sb.append(componentType.getName());
            sb.append("[]: {");

            if (!componentType.isPrimitive())
            {
                Object[] arr = (Object[]) value;

                for (int i = 0; i < arr.length; i++)
                {
                    if (i != 0)
                    {
                        sb.append(", ");
                    }

                    sb.append(arr[i]);
                }
            }
            else if (componentType == Boolean.TYPE)
            {
                boolean[] arr = (boolean[]) value;

                for (int i = 0; i < arr.length; i++)
                {
                    if (i != 0)
                    {
                        sb.append(", ");
                    }

                    sb.append(arr[i]);
                }
            }
            else if (componentType == Byte.TYPE)
            {
                byte[] arr = (byte[]) value;

                for (int i = 0; i < arr.length; i++)
                {
                    if (i != 0)
                    {
                        sb.append(", ");
                    }

                    sb.append(arr[i]);
                }
            }
            else if (componentType == Character.TYPE)
            {
                char[] arr = (char[]) value;

                for (int i = 0; i < arr.length; i++)
                {
                    if (i != 0)
                    {
                        sb.append(", ");
                    }

                    sb.append(arr[i]);
                }
            }
            else if (componentType == Double.TYPE)
            {
                double[] arr = (double[]) value;

                for (int i = 0; i < arr.length; i++)
                {
                    if (i != 0)
                    {
                        sb.append(", ");
                    }

                    sb.append(arr[i]);
                }
            }
            else if (componentType == Float.TYPE)
            {
                float[] arr = (float[]) value;

                for (int i = 0; i < arr.length; i++)
                {
                    if (i != 0)
                    {
                        sb.append(", ");
                    }

                    sb.append(arr[i]);
                }
            }
            else if (componentType == Integer.TYPE)
            {
                int[] arr = (int[]) value;

                for (int i = 0; i < arr.length; i++)
                {
                    if (i != 0)
                    {
                        sb.append(", ");
                    }

                    sb.append(arr[i]);
                }
            }
            else if (componentType == Long.TYPE)
            {
                long[] arr = (long[]) value;

                for (int i = 0; i < arr.length; i++)
                {
                    if (i != 0)
                    {
                        sb.append(", ");
                    }

                    sb.append(arr[i]);
                }
            }
            else if (componentType == Short.TYPE)
            {
                short[] arr = (short[]) value;

                for (int i = 0; i < arr.length; i++)
                {
                    if (i != 0)
                    {
                        sb.append(", ");
                    }

                    sb.append(arr[i]);
                }
            }

            sb.append("}");
        }
        else
        {
            // Obtain the objects value using toString, but protect this against null pointer exceptions, to harden
            // this implementation.
            String stringValue = null;

            try
            {
                stringValue = value.toString();
            }
            catch (NullPointerException e)
            {
                stringValue = "";
            }

            sb.append(value.getClass().getName()).append(": ").append(stringValue);
        }

        return sb.toString();
    }
Returns a string representation of the specified object, in a format suitable for debug output. If the object is
an array all its elements are extracted and displayed seperated by commas. Other objects are converted to strings
by their toString methods.

@param  value The object value to display as a string.

@return A string representation of the specified object.