Represents the value as a hexadecimal String. The String is prefixed with <code>0x</code>. For example 0x0034ab
@return value as hexadecimal String
160042
public String toHexString() {
        final int l = mValue.length;
        final char[] out = new char[l*2+2];
        out[0] = '0';
        out[1] = 'x';
        for( int i=0,j=2; i<l; i++ ){
            out[j++] = HEX_DIGITS[(0xF0 & mValue[i]) >>> 4];
            out[j++] = HEX_DIGITS[0x0F & mValue[i]];
        }
        String s = new String(out);
        return s;
    }
105525
public static String toHex(byte b) {
      StringBuilder sb = new StringBuilder();
      appendByteAsHex(sb, b);
      return sb.toString();
   }
925919
def tohexstring(self):
        
        val = self.tostring()
        st = "{0:0x}".format(int(val, 2))
        return st.zfill(len(self.bitmap)*2)
819006
public static String byteArrayToHexString(byte[] b) {

        int    len = b.length;
        char[] s   = new char[len * 2];

        for (int i = 0, j = 0; i < len; i++) {
            int c = ((int) b[i]) & 0xff;

            s[j++] = (char) HEXBYTES[c >> 4 & 0xf];
            s[j++] = (char) HEXBYTES[c & 0xf];
        }

        return new String(s);
    }
1143946
private int outputHexCharref() {
        final byte[] utfBytes;
        final int utfP;
        int utfLen;

        if (caseInsensitiveEquals(lastError.source, "UTF-32BE".getBytes())) {
            utfBytes = lastError.errorBytes;
            utfP = lastError.errorBytesP;
            utfLen = lastError.errorBytesLength;
        } else {
            Ptr utfLenA = new Ptr();

            // TODO: better calculation?
            byte[] utfBuf = new byte[lastError.errorBytesLength * UTF32BEEncoding.INSTANCE.maxLength()];
            utfBytes = allocateConvertedString(lastError.source, "UTF-32BE".getBytes(), lastError.errorBytes, lastError.errorBytesP, lastError.errorBytesLength, utfBuf, utfLenA);

            if (utfBytes == null) return -1;
            utfP = 0;
            utfLen = utfLenA.p;
        }

        if (utfLen % 4 != 0) return -1;

        int p = utfP;
        while (4 <= utfLen) {
            int u = 0; // long ??
            u += (utfBytes[p] & 0xff) << 24;
            u += (utfBytes[p + 1] & 0xff) << 16;
            u += (utfBytes[p + 2] & 0xff) << 8;
            u += (utfBytes[p + 3] & 0xff);
            byte[] charrefbuf = String.format("&#x%X;", u).getBytes(); // FIXME: use faster sprintf ??

            if (insertOutput(charrefbuf, 0, charrefbuf.length, "US-ASCII".getBytes()) == -1) return -1;

            p += 4;
            utfLen -= 4;
        }

        return 0;
    }
253055
public String getHexStringUpper() {
		int len = getVInt();
		byte[] hex = new byte[len];
		System.arraycopy(buf, bufPosition, hex, 0, hex.length);
		bufPosition += hex.length;
		return toHex(hex, true);
	}
918583
public static String toHexString(byte[] b) {
       StringBuffer result = new StringBuffer(b.length * 2);
       for (int i = 0; i < b.length; i++) {
          result.append(digits.charAt((b[i] >> 4) & 0xf));
          result.append(digits.charAt(b[i] & 0xf));
       }
       return (result.toString());
    }
36314
public String encode(String value) {
    if (value == null) { return null; }
    StringBuilder buffer = new StringBuilder();
    buffer.append(Prefix);
    buffer.append(charset);
    buffer.append(Sep);
    buffer.append(getEncoding());
    buffer.append(Sep);
    buffer.append(new String(Base64.encode(value.getBytes(charset))));
    buffer.append(Postfix);
    return buffer.toString();
  }
14548
public String getString()
    {
        int len=getInt();
        if (len==0xFFFF)
            return null;
        try
        {
            String s=new String(_buf,_pos,len,StringUtil.__ISO_8859_1);
            _pos+=len+1;
            return s;
        }
        catch (IndexOutOfBoundsException e)
        {
            // Bad request!!!
            LogSupport.ignore(log,e);
            return null;
        }
        catch (UnsupportedEncodingException e)
        {
            log.fatal(e);
            System.exit(1);
            return null;
        }
    }
944402
public static String byte2Hex(int value) {
    if (value > 255 || value < 0) {
      throw new IllegalArgumentException("The int converting to hex should be in range 0~255");
    }
    return String.valueOf(FIRST_CHAR[value]) + String.valueOf(SECOND_CHAR[value]);
  }
249993
public String getStringF() {
		int len = getInt();
		byte[] utf = new byte[len];
		System.arraycopy(buf, bufPosition, utf, 0, utf.length);
		bufPosition += utf.length;
		return new String(utf, 0, len, charsetUTF8);
	}
609222
public String encodeHex(String hexa){
      if(!hexa.matches("^[0-9a-fA-F]+$"))
          return "";

      List<Long> matched = new ArrayList<Long>();
      Matcher matcher = Pattern.compile("[\\w\\W]{1,12}").matcher(hexa);

      while (matcher.find())
          matched.add(Long.parseLong("1" + matcher.group(), 16));

      // conversion
      long[] result = new long[matched.size()];
      for(int i = 0; i < matched.size(); i++) result[i] = matched.get(i);

      return this._encode(result);
  }
1337129
public static String encode(String value) {
		if(value==null) return null;

		StringBuilder encoded=null;
		int len=value.length();
		for(int c=0;c<len;c++) {
			char ch=value.charAt(c);
			if(
				(ch<' ' && ch!='\n' && ch!='\r')
				|| ch=='\\'
			) {
				if(encoded==null) {
					encoded=new StringBuilder();
					if(c>0) encoded.append(value, 0, c);
				}
				if(ch=='\\') encoded.append("\\\\");
				else if(ch=='\b') encoded.append("\\b");
				else if(ch=='\f') encoded.append("\\f");
				else if(ch=='\t') encoded.append("\\t");
				else {
					int ich=ch;
					encoded
						.append("\\u")
						.append(hexChars[(ich>>>12)&15])
						.append(hexChars[(ich>>>8)&15])
						.append(hexChars[(ich>>>4)&15])
						.append(hexChars[ich&15])
					;
				}
			} else {
				if(encoded!=null) encoded.append(ch);
			}
		}
		return encoded==null ? value : encoded.toString();
	}
1304494
static String toHexString(final byte[] b) {
		StringBuffer sb = new StringBuffer("{");
		for (int i = 0; i < b.length; i++) {
			sb.append(toHexString(b[i]));
			if (i < b.length - 1) {
				sb.append(",");
			}
		}
		sb.append("}");
		return sb.toString();
	}
684350
public static String convertHexStringToString(String hexString) {
        String uHexString = hexString.toLowerCase();
        StringBuilder sBld = new StringBuilder();
        for (int i = 0; i < uHexString.length(); i = i + 2) {
            char c = (char)Integer.parseInt(uHexString.substring(i, i + 2), 16);
            sBld.append(c);
        }
        return sBld.toString();
    }
205389
public String getString() 
    {
        String string = null;
        if (this.getData() == null)
            return Constants.BLANK;
        double dAmount = this.getValue();

        this.initConstants();

        int iAmount, iHundreds, iTens, iOnes;
        string = Constants.BLANK;
        int iThousands = (int)((dAmount + 0.005) / 1000);
        int iRest = (int)(dAmount - iThousands * 1000 + 0.005);

        string = Constants.BLANK;
        if ((int)dAmount == 0)
            string = NUMBERS[0] + ' ';  // Zero
        else
        {
            for (int setup = 1; setup <= 2; setup++)
            {
                if (setup == 1)
                    iAmount = iThousands;
                else
                    iAmount = iRest;
                iHundreds = iAmount / 100;
                iTens = (iAmount - iHundreds * 100) / 10;
                iOnes = iAmount - iHundreds * 100 - iTens * 10;
                if (iHundreds != 0)
                    string += NUMBERS[iHundreds] + ' ' + HUNDRED + ' ';
                if (iTens * 10 + iOnes > 19)
                    string += TENS[iTens] + " ";
                else
                {
                    if (iTens == 1)
                    {
                        string += TEENS[iOnes] + " ";
                        iOnes = 0;
                    }
                }
                if (iOnes != 0)
                    string += NUMBERS[iOnes] + " ";
                if (setup == 1) if (iAmount != 0)
                    string += THOUSAND + ' ';
            }
        }
        if ((string.length() > 54) || (dAmount >= 1000000))
        {
            int strBin = (int)dAmount;
            string = Integer.toString(strBin);
            string += " ";
        }
        String centsString;
        int iCents = ((int)(dAmount - ((int)dAmount) + .001) * 100);
        centsString = Integer.toString(iCents);
        if (centsString.length() == 1)
            centsString = "0" + centsString;
        
        this.initCurrency();
        
        string = Constants.BLANK + string + DOLLAR;
        if ((dAmount > 1) || (dAmount == 0))
            string = string + PLURAL;
        string = string + ' ' + AND + ' ' + centsString + ' ' + CENT;
        if ((iCents > 1) || (iCents == 0))
            string = string + PLURAL;
        return string;
    }
856549
public static String hex(String x) {
		return EncodingUtils.hex(x.getBytes(StandardCharsets.UTF_8)).toUpperCase();
	}