private static byte[] getBytes(String string, Charset charset) {
        if (string == null) {
            return null;
        }
        return string.getBytes(charset);
    }
private static byte [ ] getBytes ( String string , Charset charset ) { if ( string == null ) { return null ; } return string . getBytes ( charset ) ; }
Calls {@link String#getBytes(Charset)}

@param string
The string to encode (if null, return null).
@param charset
The {@link Charset} to encode the {@code String}
@return the encoded bytes