Java Utililty Methods Byte Array to String

List of utility methods to do Byte Array to String

Description

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

Method

StringbyteToStr(byte[] byteArray)
byte To Str
String strDigest = "";
for (int i = 0; i < byteArray.length; i++) {
    strDigest += byteToHexStr(byteArray[i]);
return strDigest;
StringbyteToStr(byte[] byteArray)
byte To Str
String strDigest = "";
for (int i = 0; i < byteArray.length; i++) {
    strDigest += byteToHexStr(byteArray[i]);
return strDigest;
StringByteToString(byte[] a, int nLen)
Byte To String
int nALen = a.length;
if (nLen < 0) {
    for (int i = (nALen - 1); i > 0; i--) {
        if (a[i] != 0) {
            nLen = i + 1;
            break;
if (nALen < nLen) {
    nLen = nALen;
if (nLen == 0) {
    return "";
} else {
    byte[] bstr = new byte[nLen];
    System.arraycopy(a, 0, bstr, 0, nLen);
    return new String(bstr);
StringbyteToString(byte[] array, int byteLength)
convert a part of a byte array into a String.
return new String(array, 0, byteLength);
StringbyteToString(byte[] b)
byte To String
StringBuffer strBuffer = new StringBuffer();
for (int i = 0; i < b.length; i++) {
    strBuffer.append(strDigits[(b[i] & 0xf0) >>> 4]);
    strBuffer.append(strDigits[b[i] & 0x0f]);
return strBuffer.toString();
StringbyteToString(byte[] bByte)
byte To String
int k = 0;
int len = bByte.length;
char[] myChar = new char[len * 2];
for (byte b : bByte) {
    myChar[k++] = HEX_DIGITS[b >>> 4 & 0x0f];
    myChar[k++] = HEX_DIGITS[b & 0x0f];
return new String(myChar);
...
StringbyteToString(byte[] bByte)
byte To String
StringBuffer sBuffer = new StringBuffer();
for (int i = 0; i < bByte.length; i++) {
    sBuffer.append(byteToArrayString(bByte[i]));
return sBuffer.toString();
StringbyteToString(byte[] byteArr)
convert byte array into string
if (byteArr != null) {
    return new String(byteArr);
} else {
    return null;
StringbyteToString(byte[] bytearray)
byte To String
String result = "";
char temp;
int length = bytearray.length;
for (int i = 0; i < length; i++) {
    temp = (char) bytearray[i];
    result += temp;
return result;
...
StringbyteToString(byte[] bytes)
byte To String
char[] chars = new char[bytes.length];
for (int i = 0; i < bytes.length; i++) {
    chars[i] = (char) bytes[i];
return String.copyValueOf(chars);