Android Utililty Methods Array to String Convert

List of utility methods to do Array to String Convert

Description

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

Method

StringtoString(byte[] ba)
to String
return toString(ba, 0, ba.length);
StringtoString(byte[] ba, int offset, int length)
to String
char[] buf = new char[length * 2];
for (int i = 0, j = 0, k; i < length;) {
    k = ba[offset + i++];
    buf[j++] = HEX_DIGITS[(k >>> 4) & 0x0F];
    buf[j++] = HEX_DIGITS[k & 0x0F];
return new String(buf);
StringbyteToString(byte[] str)
byte To String
StringBuilder sb = new StringBuilder();
for (int i = 0; i < str.length; i++) {
    sb.append(StringUtil.toHexString(str[i]));
    sb.append(" ");
return sb.toString();
StringtoString(byte[] buffer)
Method convert byte[] to String
if (null == buffer)
    return null;
else
    return new String(buffer);
StringtoString(final byte[] bytes)
to String
if (bytes == null) {
    return null;
try {
    return new String(bytes, CHARSET_NAME_UTF8);
} catch (final UnsupportedEncodingException e) {
    throw new RuntimeException(e.getMessage(), e);
StringtoString(final byte[] bytes, String charset)
to String
if (bytes == null) {
    return null;
try {
    return new String(bytes, charset);
} catch (final UnsupportedEncodingException e) {
    throw new RuntimeException(e.getMessage(), e);
StringtoStringArrayToString(String[] array)
to String Array To String
Collection<String> c = new Vector<String>();
for (int i = 0; i < array.length; i++) {
    c.add(array[i]);
return c.toString();
StringArraysToString(String[] arrays)
Arrays To String
String result = "";
if (arrays != null && arrays.length > 0) {
    for (String value : arrays) {
        result += value + ",";
    result = result.substring(0, result.length() - 1);
return result;
...
StringArrayToString(Object[] ary)
Array To String
if (ary == null) {
    return null;
StringBuilder sb = new StringBuilder();
sb.append("{");
for (int i = 0; i < ary.length; ++i) {
    sb.append(ary[i].toString());
    sb.append(",");
...
StringstringArrayToString(String[] array)
string Array To String
return arrayToString(array);