Convert buffer to a Hex Summary String.

@param buffer the buffer to generate a hex byte summary from
@return A string showing a summary of the content in hex
175710
public static String toHexSummary(ByteBuffer buffer) {
        if (buffer == null)
            return "null";
        StringBuilder buf = new StringBuilder();

        buf.append("b[").append(buffer.remaining()).append("]=");
        for (int i = buffer.position(); i < buffer.limit(); i++) {
            TypeUtils.toHex(buffer.get(i), buf);
            if (i == buffer.position() + 24 && buffer.limit() > buffer.position() + 32) {
                buf.append("...");
                i = buffer.limit() - 8;
            }
        }
        return buf.toString();
    }
532902
public static String toHex(byte b) {
    final char[] string = { hexDigits[(b >> 4) & 0x0f], hexDigits[b & 0x0f] };
    return new String(string);
  }
169567
public static String toHex(final byte[] bytes) {
        if (bytes == null) {
            return "";
        }
        StringBuffer sb = new StringBuffer(bytes.length * 2);
        for (byte b : bytes) {
            appendHex(sb, b);
        }
        return sb.toString();
    }
127348
private static String byteArrayToHexString(byte[] bytes) {
        StringBuilder sb = new StringBuilder(bytes.length * 2);
        for (byte element : bytes) {
            int v = element & 0xff;
            if (v < 16) {
                sb.append('0');
            }
            sb.append(Integer.toHexString(v));
        }
        return sb.toString();
    }
261067
private static String getHexString(byte[] bytes) {

        // If null byte array given, return null
        if (bytes == null)
            return null;

        // Create string builder for holding the hex representation,
        // pre-calculating the exact length
        StringBuilder hex = new StringBuilder(2 * bytes.length);

        // Convert each byte into a pair of hex digits
        for (byte b : bytes) {
            hex.append(HEX_CHARS[(b & 0xF0) >> 4])
               .append(HEX_CHARS[ b & 0x0F      ]);
        }

        // Return the string produced
        return hex.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();
	}
327279
public final static String toHex(byte [] b) {
	char[] buf = new char[b.length * 2];
	int i, j, k;

	i = j = 0;
	for (; i < b.length; i++) {
	    k = b[i];
	    buf[j++] = hex[(k >>> 4) & 0x0F];
	    buf[j++] = hex[ k & 0x0F];
	}
	return new String(buf);
    }
1091280
public static String prettyHexDump(ByteBuf buffer, int offset, int length) {
        return HexUtil.prettyHexDump(buffer, offset, length);
    }
1126937
public static byte[] readBytes(ByteBuffer buffer) {
		final int remaining = buffer.remaining();
		byte[] ab = new byte[remaining];
		buffer.get(ab);
		return ab;
	}
204996
private static String generateString(byte[] bytes) {

    StringBuffer sb = new StringBuffer();

    for (byte b : bytes) {

      int v = b & 0xFF;

      sb.append((char) HEX.charAt(v >> 4));
      sb.append((char) HEX.charAt(v & 0x0f));
    }

    return sb.toString();
  }
224373
static String toHexString(final byte b) {
		String hexString = Integer.toHexString(b & 0xFF);
		if (hexString.length() % 2 != 0) {
			// Pad with 0
			hexString = "0" + hexString;
		}
		return hexString;
	}
210114
public static final String toHex(byte[] buf)
    {
        StringBuilder sb = new StringBuilder();
        int prec = prec(buf.length);
        for (int ii=0;ii<prec;ii++)
        {
            sb.append(' ');
        }
        sb.append("  ");
        String format = "%0"+prec+"x: ";
        sb.append(Title);
        sb.append('\n');
        for (int ii=0;ii<buf.length;ii+=16)
        {
            printLine(sb, format, buf, ii, Math.min(16, buf.length - ii));
        }
        return sb.toString();
    }
717648
public String digestHex(InputStream data, int bufferLength) {
		return HexUtil.encodeHexStr(digest(data, bufferLength));
	}
1233989
function buffer2StringValue(buffer) {
    var length = buffer.length;
    var output = '0x';
    for (var i = length; i > 0; i--) {
        output += buffer.slice(i - 1, i).toString('hex');
    }
    return output;
}
245421
public static String toHexString(byte[] bytes) {
		final int l = bytes.length;
		final char[] out = new char[l << 1];

		for (int i = 0, j = 0; i < l; i++) {
			out[j++] = hexDigits[(0xF0 & bytes[i]) >>> 4];
			out[j++] = hexDigits[0x0F & bytes[i]];
		}
		return new String(out);
	}
1185807
public static String encodeHex(byte[] bytes) {
		char[] result = new char[bytes.length * 2];
		for (int i = 0; i < bytes.length; i++) {
			result[i * 2] = hexa[(bytes[i] & 0xF0) >> 4];
			result[i * 2 + 1] = hexa[bytes[i] & 0x0F];
		}
		return new String(result);
	}
201393
private static String bytesToHex(byte[] bytes) {
        char[] hexChars = new char[bytes.length * 2];
        for (int i = 0; i < bytes.length; i++) {
            int v = bytes[i] & 0xFF;
            hexChars[i * 2] = hexArray[v >>> 4];
            hexChars[i * 2 + 1] = hexArray[v & 0x0F];
        }
        return new String(hexChars);
    }