Java Utililty Methods Hex Calculate

List of utility methods to do Hex Calculate

Description

The list of methods to do Hex Calculate are organized into topic(s).

Method

StringtoHexString(byte[] digest)
to Hex String
String chars = "0123456789abcdef";
StringBuilder buffer = new StringBuilder(digest.length * 2);
for (int i = 0; i < digest.length; i++) {
    int b = digest[i] & 0xFF;
    buffer.append(chars.charAt(b >> 4));
    buffer.append(chars.charAt(b & 0xF));
return buffer.toString();
...
StringtoHexString(byte[] digest)
byte to hex
String str = "";
String tempStr = "";
for (int i = 0; i < digest.length; i++) {
    tempStr = (Integer.toHexString(digest[i] & 0xff));
    if (tempStr.length() == 1)
        str = str + "0" + tempStr;
    else
        str = str + tempStr;
...
StringtoHexString(byte[] digest)
to Hex String
StringBuilder bld = new StringBuilder();
appendHex(bld, digest);
return bld.toString();
StringtoHexString(byte[] digestByte)
to Hex String
return new String(toHex(digestByte));
StringtoHexString(byte[] in)
to Hex String
byte ch = 0x00;
int i = 0;
if (in == null || in.length <= 0)
    return null;
String pseudo[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F" };
StringBuffer out = new StringBuffer(in.length * 2);
while (i < in.length) {
    ch = (byte) (in[i] & 0xF0);
...
StringtoHexString(byte[] input)
Convert a byte array to the corresponding hexstring.
String result = "";
for (int i = 0; i < input.length; i++) {
    result += HEX_CHARS[(input[i] >>> 4) & 0x0f];
    result += HEX_CHARS[(input[i]) & 0x0f];
return result;
StringtoHexString(byte[] md)
to Hex String
char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
int j = md.length;
char str[] = new char[j * 2];
for (int i = 0; i < j; i++) {
    byte byte0 = md[i];
    str[2 * i] = hexDigits[byte0 >>> 4 & 0xf];
    str[i * 2 + 1] = hexDigits[byte0 & 0xf];
return new String(str);
StringtoHexString(byte[] messagePayload)
to Hex String
String pystr = "";
for (byte b : messagePayload) {
    pystr = pystr + (Integer.toHexString(0xFF & b)) + " ";
return pystr.trim();
StringtoHexString(byte[] paramArrayOfByte)
to Hex String
if (paramArrayOfByte == null)
    return "";
StringBuilder localStringBuilder = new StringBuilder(paramArrayOfByte.length << 1);
for (int i = 0;; i++) {
    if (i >= paramArrayOfByte.length)
        return localStringBuilder.toString();
    localStringBuilder.append(HEX_DIGITS[((0xF0 & paramArrayOfByte[i]) >>> 4)]);
    localStringBuilder.append(HEX_DIGITS[(0xF & paramArrayOfByte[i])]);
...
StringtoHexString(byte[] paramArrayOfByte, String paramString, boolean paramBoolean)
to Hex String
StringBuilder localStringBuilder = new StringBuilder();
int i = paramArrayOfByte.length;
for (int j = 0; j < i; j++) {
    String str = Integer.toHexString(0xFF & paramArrayOfByte[j]);
    if (paramBoolean)
        str = str.toUpperCase();
    if (str.length() == 1)
        localStringBuilder.append("0");
...