Java Utililty Methods Byte to String

List of utility methods to do Byte to String

Description

The list of methods to do Byte to String are organized into topic(s).

Method

StringbyteToArrayString(byte bByte)
byte To Array String
int iRet = bByte;
if (iRet < 0) {
    iRet += 256;
int iD1 = iRet / 16;
int iD2 = iRet % 16;
return strDigits[iD1] + strDigits[iD2];
StringbyteToStr(byte input)
byte To Str
String res = Integer.toHexString(input & 0xff);
if (res.length() < 2) {
    res = "0" + res;
return res;
StringbyteToString(byte b)
byte To String
String s = "0x";
for (int i = 0; i < 8; i++) {
    if ((b & (1 << 7 - i)) > 0)
        s += "1";
    else
        s += "0";
return s;
...
StringbyteToString(byte b)
byte To String
String hexadecimal = "00";
if (b < 0) {
    hexadecimal = Integer.toHexString(b).substring(6);
} else {
    hexadecimal = Integer.toHexString(b);
if (hexadecimal.length() < 2)
    hexadecimal = "0" + hexadecimal;
...
StringbyteToString(byte b)
byte To String
String result = String.valueOf(Integer.toHexString(b & 0xFF));
if (result.length() == 1)
    result = "0" + result;
return result.toUpperCase();
StringByteToString(byte b)
Byte To String
return "" + (char) b;
StringbyteToString(byte b_)
Converts a byte to a String.
return cToS(byteToChar(b_));
StringbyteToString(int b)
Get a string presentation of the 8 bits in a byte
StringBuilder result = new StringBuilder("{");
for (int ind = 7; ind >= 0; ind--) {
    if (getBitInInt(b, ind) == 1) {
        result.append("1");
    } else {
        result.append("0");
result.append("}");
return result.toString();
StringbyteToString(int b)
Convert a byte to a human readable representation
String s = Integer.toHexString(b);
if (s.length() == 1)
    s = "0" + s;
else
    s = s.substring(s.length() - 2);
return s;
StringbyteToString(int b)
byte To String
return Integer.toString(b);