Java Utililty Methods Array to String

List of utility methods to do Array to String

Description

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

Method

voidasStringOn(StringBuilder sb, Object[] items, String separator)
Copies the array items onto the string builder each delimited by the separator.
if (items == null || items.length == 0) {
    return;
sb.append(items[0]);
for (int i = 1; i < items.length; i++) {
    sb.append(separator);
    sb.append(items[i]);
StringbitsToString(int[] arr)
Returns a string representing an array of 0's and 1's
char[] s = new char[arr.length + 1];
Arrays.fill(s, '.');
s[0] = 'c';
for (int i = 0; i < arr.length; i++) {
    if (arr[i] == 1) {
        s[i + 1] = '*';
return new String(s);
StringbyteMapToString(Map map)
byte Map To String
if (map == null)
    return null;
if (map.isEmpty()) {
    return map.toString();
String result = "[ ";
for (Map.Entry<String, byte[]> entry : map.entrySet()) {
    result += "{" + entry.getKey() + " : " + Arrays.hashCode(entry.getValue()) + "} ";
...
StringbytesToString(byte[] buffer)
bytes To String
byte[] bytes = null;
for (int i = 0; i < buffer.length; i++) {
    if (buffer[i] == '\0') {
        bytes = Arrays.copyOfRange(buffer, 0, i);
        break;
return new String(bytes);
...
StringconvertArrayToString(double[] p)
convert Array To String
String s = "";
for (int i = 0; i < p.length; i++) {
    s += p[i] + ";";
return s;
StringconvertArrayToString(Object param)
convert Array To String
String ids = "";
if (param != null) {
    for (String paramValue : (String[]) param) {
        ids += paramValue + ",";
    ids = ids.replaceAll(",$", "");
return ids;
...
StringconvertArrayToString(Object[] array, String separator)
Converts an array of objects to a plain string with a given separator
if (array == null) {
    return "";
StringBuffer result = new StringBuffer();
for (int i = 0; i < array.length; i++) {
    result.append(array[i]);
    result.append(separator);
return result.toString();
StringconvertArrayToString(Object[] ig, int count)
convert Array To String
if (ig != null && ig.length > 0) {
    StringBuilder str = new StringBuilder("");
    for (int i = 0; i < ig.length && i < count; i++) {
        str.append(String.valueOf(ig[i])).append(",");
    return str.substring(0, str.length() - 1);
return "";
...
StringconvertArrayToString(Object[] objArr)
convert Array To String
if (objArr == null)
    return "null";
String ret = "";
for (int i = 0; i < objArr.length; i++) {
    if (i != 0)
        ret += ",";
    ret += objArr[i];
return ret;
StringconvertArrayToString(String[] array)
converts the specified String array to a token String.
if (array == null || array.length == 0) {
    return "";
final char token = ',';
StringBuffer result = new StringBuffer();
for (int i = 0, size = array.length; i < size; i++) {
    if (array[i] == null || array[i].length() == 0) {
        continue;
...