private String bytesToHex(byte[] bytesToConvert) {

        if(bytesToConvert == null)
        {
            return null;
        }

        if(bytesToConvert.length == 0)
        {
            return UtilGlobal.EMPTY;
        }

        char[] hexChars = new char[bytesToConvert.length * 2];

        for ( int index = 0; index < bytesToConvert.length; index++ ) {
            int andWith127 = (bytesToConvert[index] & 0xFF);
            hexChars[index * 2] = HEX_ARRAY[andWith127 >>> 4];
            hexChars[index * 2 + 1] = HEX_ARRAY[andWith127 & 0x0F];
        }

        return new String(hexChars);
    }
private String bytesToHex ( byte [ ] bytesToConvert ) { if ( bytesToConvert == null ) { return null ; } if ( bytesToConvert . length == 0 ) { return UtilGlobal . EMPTY ; } char [ ] hexChars = new char [ bytesToConvert . length * 2 ] ; for ( int index = 0 ; index < bytesToConvert . length ; index ++ ) { int andWith127 = ( bytesToConvert [ index ] & 0xFF ) ; hexChars [ index * 2 ] = HEX_ARRAY [ andWith127 > > > 4 ] ; hexChars [ index * 2 + 1 ] = HEX_ARRAY [ andWith127 & 0x0F ] ; } return new String ( hexChars ) ; }
Convert the byte[] to a HEX string as upper case.

@param bytesToConvert The {@code byte[]} to convert.
@return String with upper case HEX.