public static byte[] toBytes(char[] chars) {
        return toBytes(new String(chars), PREFERRED_ENCODING);
    }
Converts the specified character array to a byte array using the Shiro's preferred encoding (UTF-8).
<p/>
This is a convenience method equivalent to calling the {@link #toBytes(String, String)} method with a
a wrapping String and {@link CodecSupport#PREFERRED_ENCODING PREFERRED_ENCODING}, i.e.
<p/>
<code>toBytes( new String(chars), {@link CodecSupport#PREFERRED_ENCODING PREFERRED_ENCODING} );</code>

@param chars the character array to be converted to a byte array.
@return the byte array of the UTF-8 encoded character array.
lang/src/main/java/org/apache/shiro/lang/codec/CodecSupport.java