Returns the value of {@code b} as a hexadecimal string, starting with "0x".

@param b
the byte
@return the string representation of {@code b} in hexadecimal, with a
leading "0x".
194299
public static String toHexString(byte b) {
    StringBuffer sb = new StringBuffer(4);
    sb.append("0x").append(HEX_CHARS[0x0F & (b >> 4)])
        .append(HEX_CHARS[b & 0x0F]);
    return sb.toString();
  }
403019
public static String binToHex(byte[] bin)
  {
    StringBuffer hex = new StringBuffer();
    binToHex(bin,0,bin.length,hex);
    return hex.toString();
  }
801110
public static String toHex( byte[] bytes ) {
        StringBuffer buf = new StringBuffer();
        for( int i = 0; i < bytes.length; i++ ) {
            byte b = bytes[i];
            buf.append(toHexDigit((b >> 4) & 0x0F));
            buf.append(toHexDigit(b & 0x0F));
        }
        return buf.toString();
    }
274814
public static String toHex(byte[] bytes) {
		StringBuilder hexString=new StringBuilder();
		for (int i=0; i<bytes.length; i++) {

			String hex=Integer.toHexString(0xFF & bytes[i]);
			if (hex.length() == 1) {
				hexString.append('0');
			}

			hexString.append(hex);
		}

		return hexString.toString();
	}
597468
public String toHexString() {
        StringBuilder builder = new StringBuilder();
        for (byte b : bytes) {
            builder.append(String.format("%02x", b));
        }
        return builder.toString();
    }
638693
public static String toHex(byte[] b) {
        char[] buf = new char[b.length * 2];
        int j = 0;
        int k;

        for (byte aB : b) {
            k = aB;
            buf[j++] = HEX[(k >>> 4) & 0x0F];
            buf[j++] = HEX[k & 0x0F];
        }
        return new String(buf);
    }
217289
public static String toHexString(byte[] b, int offset, int length) {
        StringBuilder buf = new StringBuilder();
        for (int i = offset; i < offset + length; i++) {
            int bi = 0xff & b[i];
            int c = '0' + (bi / 16) % 16;
            if (c > '9') {
                c = 'A' + (c - '0' - 10);
            }
            buf.append((char) c);
            c = '0' + bi % 16;
            if (c > '9') {
                c = 'a' + (c - '0' - 10);
            }
            buf.append((char) c);
        }
        return buf.toString();
    }
840063
public static String byteArrayToHexString(byte[] b) {
		StringBuffer sb = new StringBuffer();
		for (int i = 0; i < b.length; i++) {
			sb.append(byteToHexString(b[i]));
		}
		return new String(sb);
	}
688135
static String hex0(final byte x) {
        final char tab[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
                'a', 'b', 'c', 'd', 'e', 'f' };
        int uint;
        if (x < 0) {
            uint = x & 0x7F;
            uint |= 1 << 7;
        } else {
            uint = x;
        }
        return "" + tab[uint >>> 4] + tab[uint & 0xF];
    }
366656
public static final String bytesToHex(byte[] bs, int off, int length) {
        if (bs.length <= off || bs.length < off + length)
            throw new IllegalArgumentException();
        StringBuilder sb = new StringBuilder(length * 2);
        bytesToHexAppend(bs, off, length, sb);
        return sb.toString();
    }
974001
public final String toHexString() {
		if (this.hexString == null) {
			final byte[] ba = new byte[SIZE];
			longToByteArray(this.lowerPart, ba, 0);
			longToByteArray(this.upperPart, ba, SIZE_OF_LONG);

			this.hexString = StringUtils.byteToHexString(ba);
		}

		return this.hexString;
	}
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());
    }
571714
public static String toHexString(BigInteger b) {
        String hexValue = b.toString(16);
        StringBuffer buf = new StringBuffer(hexValue.length()*2);

        if (hexValue.startsWith("-")) {
            buf.append("   -");
            hexValue = hexValue.substring(1);
        } else {
            buf.append("    ");     // four spaces
        }
        if ((hexValue.length()%2) != 0) {
            // add back the leading 0
            hexValue = "0" + hexValue;
        }
        int i=0;
        while (i < hexValue.length()) {
            // one byte at a time
            buf.append(hexValue.substring(i, i+2));
            i+=2;
            if (i!= hexValue.length()) {
                if ((i%64) == 0) {
                    buf.append("\n    ");     // line after eight words
                } else if (i%8 == 0) {
                    buf.append(" ");     // space between words
                }
            }
        }
        return buf.toString();
    }
204855
public static String toHexString(byte[] value) {
    String newString = "";
    for (int i = 0; i < value.length; i++) {
      byte b = value[i];
      String str = Integer.toHexString(b);
      if (str.length() > 2) {
        str = str.substring(str.length() - 2);
      }
      if (str.length() < 2) {
        str = "0" + str;
      }
      newString += str;
    }
    return newString.toUpperCase();
  }
920534
public static String fromByteArray(byte[] ba) {
        if ((ba != null) && (ba.length == 16)) {
            StringBuilder result = new StringBuilder(36);
            for (int i = 0; i < 16; ++i) {
                if ((i == 4) || (i == 6) || (i == 8) || (i == 10)) {
                    result.append('-');
                }
                result.append(hexChars.charAt(((ba[i] & 0xF0) >>> 4)));
                result.append(hexChars.charAt((ba[i] & 0xF)));
            }
            return result.toString();
        }
        return null;
    }
1359712
public BEValue bdecodeNumber() throws IOException {
    int c = this.getNextIndicator();
    if (c != 'i') {
      throw new InvalidBEncodingException("Expected 'i', not '" +
              (char) c + "'");
    }
    this.indicator = 0;

    c = this.read();
    if (c == '0') {
      c = this.read();
      if (c == 'e')
        return new BEValue(BigInteger.ZERO);
      else
        throw new InvalidBEncodingException("'e' expected after zero," +
                " not '" + (char) c + "'");
    }

    // We don't support more the 255 char big integers
    char[] chars = new char[256];
    int off = 0;

    if (c == '-') {
      c = this.read();
      if (c == '0')
        throw new InvalidBEncodingException("Negative zero not allowed");
      chars[off] = '-';
      off++;
    }

    if (c < '1' || c > '9')
      throw new InvalidBEncodingException("Invalid Integer start '"
              + (char) c + "'");
    chars[off] = (char) c;
    off++;

    c = this.read();
    int i = c - '0';
    while (i >= 0 && i <= 9) {
      chars[off] = (char) c;
      off++;
      c = read();
      i = c - '0';
    }

    if (c != 'e')
      throw new InvalidBEncodingException("Integer should end with 'e'");

    String s = new String(chars, 0, off);
    return new BEValue(new BigInteger(s));
  }
739944
public static String convertToHexString(byte[] toBeConverted) {
        if (toBeConverted == null) {
            throw new NullPointerException("Parameter to be converted can not be null");
        }

        char[] converted = new char[toBeConverted.length * 2];
        for (int i = 0; i < toBeConverted.length; i++) {
            byte b = toBeConverted[i];
            converted[i * 2] = HEX_CHARS[b >> 4 & 0x0F];
            converted[i * 2 + 1] = HEX_CHARS[b & 0x0F];
        }

        return String.valueOf(converted);
    }