protected String toString(Object o) {
        if (o == null) {
            String msg = "Argument for String conversion cannot be null.";
            throw new IllegalArgumentException(msg);
        }
        if (o instanceof byte[]) {
            return toString((byte[]) o);
        } else if (o instanceof char[]) {
            return new String((char[]) o);
        } else if (o instanceof String) {
            return (String) o;
        } else {
            return objectToString(o);
        }
    }
Converts the specified Object into a String.
<p/>
If the argument is a {@code byte[]} or {@code char[]} it will be converted to a String using the
{@link #PREFERRED_ENCODING}.  If a String, it will be returned as is.
<p/>
If the argument is anything other than these three types, it is passed to the
{@link #objectToString(Object) objectToString} method.

@param o the Object to convert into a byte array
@return a byte array representation of the Object argument.
lang/src/main/java/org/apache/shiro/lang/codec/CodecSupport.java