public static String toHexString(byte[] b) {
        if (b == null)
            return null;

        StringBuilder sb = new StringBuilder(b.length * 2);
        for (int i = 0; i < b.length; i++) {
            int v = b[i] & 0xFF;
            String hv = Integer.toHexString(v);
            if (hv.length() < 2) {
                sb.append(0);
            }
            sb.append(hv);
        }
        return sb.toString();
    }
public static String toHexString ( byte [ ] b ) { if ( b == null ) return null ; StringBuilder sb = new StringBuilder ( b . length * 2 ) ; for ( int i = 0 ; i < b . length ; i ++ ) { int v = b [ i ] & 0xFF ; String hv = Integer . toHexString ( v ) ; if ( hv . length ( ) < 2 ) { sb . append ( 0 ) ; } sb . append ( hv ) ; } return sb . toString ( ) ; }
将 byte[] 数组转换成16进制字符串

@param b
@return 传入参数为null, 将返回null