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[] bytes)
to Hex String
StringBuilder sign = new StringBuilder();
for (int i = 0; i < bytes.length; i++) {
    String hex = Integer.toHexString(bytes[i] & 0xFF);
    if (hex.length() == 1) {
        sign.append("0");
    sign.append(hex);
return sign.toString();
StringtoHexString(byte[] bytes)
to Hex String
return toHexString(bytes, 8);
StringtoHexString(byte[] bytes)
to Hex String
int l = bytes.length;
char[] out = new char[l << 1];
for (int i = 0, j = 0; i < l; i++) {
    out[j++] = DIGITS[(0xF0 & bytes[i]) >>> 4];
    out[j++] = DIGITS[0x0F & bytes[i]];
return new String(out);
StringtoHexString(byte[] bytes)
Convert bytes to hex string.
StringBuilder sb = new StringBuilder();
for (byte b : bytes) {
    sb.append(toHexString(b) + " ");
return sb.toString();
StringtoHexString(byte[] bytes)
to Hex String
if (bytes == null || bytes.length == 0) {
    return "";
} else {
    StringBuffer buffer = new StringBuffer();
    for (byte b : bytes) {
        buffer.append(CHAR_ARRAY[(b >> 4) & 0xF]);
        buffer.append(CHAR_ARRAY[b & 0xF]); 
    return buffer.toString();
StringtoHexString(byte[] bytes)
Converts an array of bytes to an Hexadecimal String
StringBuffer stringBuffer = new StringBuffer(3 * bytes.length + 2);
for (int i = 0; i < bytes.length; i++) {
    int c = bytes[i];
    if (c < 0) {
        c += 256;
    stringBuffer.append(HEXES[c / 16]);
    stringBuffer.append(HEXES[c % 16]);
...
StringtoHexString(byte[] bytes)
Creates a hexadecimal representation of all given bytes an concatenates these hex-values to a single string.
char[] hexChars = new char[bytes.length * 2];
int v;
for (int j = 0; j < bytes.length; j++) {
    v = bytes[j] & 0xFF;
    hexChars[j * 2] = HEX_DIGITS[v >>> 4];
    hexChars[j * 2 + 1] = HEX_DIGITS[v & 0x0F];
return new String(hexChars);
...
StringtoHexString(byte[] bytes)
to Hex String
int count = bytes.length;
StringBuilder answer = new StringBuilder(count * 2);
for (int i = 0; i < count; i++) {
    byte b = bytes[i];
    answer.append(_hexDigits[(b >> 4) & 0xf]);
    answer.append(_hexDigits[b & 0xf]);
return answer.toString();
...
StringtoHexString(byte[] bytes)
byte array to base16
final char[] res = new char[bytes.length * 2];
for (int i = 0; i < bytes.length; i++) {
    int t = ((int) bytes[i]) & 0xFF;
    res[i * 2] = base32[(t >> 4) & 15];
    res[i * 2 + 1] = base32[t & 15];
return String.valueOf(res);
StringtoHexString(byte[] bytes)
to Hex String
StringBuffer buffer = new StringBuffer(bytes.length);
int startIndex = 0;
int column = 0;
for (int i = 0; i < bytes.length; i++) {
    column = i % 16;
    switch (column) {
    case 0:
        startIndex = i;
...