Java Utililty Methods Byte Array to String

List of utility methods to do Byte Array to String

  1. HOME
  2. Java
  3. B
  4. Byte Array to String

Description

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

Method

String arr2String(byte[] arr, int start)
arr String
int offset = 0;
while (arr[start + offset] != 0) {
 offset++;
return new String(arr, start, offset);
String ASCIIByteArrayToString(byte[] data)
Convert a byte array into a 2 byte per character Java String by adding a 0-byte in front of each byte.
StringBuilder r = new StringBuilder("");
for (byte b : data) {
 r.append((char) (b & 0xFF));
return r.toString();
String asString(byte[] a, String separator)
Converts a array of numbers into a String.
StringBuffer sbuff = new StringBuffer();
for (int i = 0; i < a.length; i++)
 sbuff.append(a[i] + separator);
sbuff.setLength(sbuff.length() - 1);
return sbuff.toString();
String asString(byte[] array)
Converts the given byte array to a string using a default separator character.
return asString(array, ':');
String asString(byte[] bs)
As string.
StringBuilder buf = new StringBuilder();
for (byte b : bs) {
 if (buf.length() != 0) {
 buf.append(':');
 if (b >= 0 && b < 16) {
 buf.append('0');
 buf.append(Integer.toHexString((b < 0) ? b + 256 : b).toUpperCase());
return buf.toString();
String asString(byte[] buf)
as String
StringBuffer strbuf = new StringBuffer(buf.length);
for (int i = 0; i < buf.length; i++) {
 strbuf.append((char) buf[i]);
return strbuf.toString();
String asString(byte[] bytes)
Return the String representation of the byte array.
if (bytes == null) {
 return null;
if (bytes.length == 0) {
 return EMPTY_STRING;
return new String(bytes);
String asString(byte[] bytes)
as String
if (bytes != null) {
 return new String(bytes);
} else {
 return "";
String ByteArrayToString(byte[] byteArray)
Byte Array To String
return Arrays.toString(byteArray);
String bytes2str(byte[] arr)
Converts a byte array to a String .
return new String(arr);


AltStyle によって変換されたページ (->オリジナル) /