Java Utililty Methods Integer Array to String

List of utility methods to do Integer Array to String

Description

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

Method

StringintArrayToString(int[] iarray, int count)
Put array values in parentheses separated by commas.
if (count > 0) {
    StringBuilder sb = new StringBuilder("[");
    for (int i = 0; i < count; i++) {
        sb.append(iarray[i]);
        if (i < count - 1)
            sb.append(", ");
    sb.append("]");
...
StringintArrayToString(int[] intArray)
Convert integer array to a string.
String ret = "";
for (int i = 0; i < intArray.length; i++) {
    if (ret.length() > 0)
        ret = ret + "," + Integer.toString(intArray[i]);
    else
        ret = Integer.toString(intArray[i]);
return ret;
...
StringintArrayToString(int[] intArray, String conv)
int Array To String
String strReturn = "";
int length = intArray.length;
if (length > 0) {
    for (int i = 0; i < length - 1; i++) {
        strReturn += intArray[i] + conv;
    strReturn += intArray[length - 1];
return strReturn;
StringintArrayToString(int[] ints)
Converts an array of integers to a string which can be inserted into log messages.
return arrayToString(ints);
StringintArrayToString(int[] ints)
int Array To String
StringBuffer sb = new StringBuffer();
if (ints != null) {
    for (int i = 0; i < ints.length; i++) {
        if (i != 0) {
            sb.append(", ");
        sb.append(ints[i]);
} else {
    sb.append("null");
return sb.toString();
StringintArrayToString(String tag, int[] arr)
int Array To String
StringBuilder builder = new StringBuilder("\"");
builder.append(tag + "\"" + ":[");
for (int i = 0, len = arr.length; i < len - 1; i++)
    builder.append(arr[i] + ",");
builder.append(arr[arr.length - 1] + "]");
return builder.toString();
String[]intArrayToStringArray(int[] ids)
int Array To String Array
String[] res = new String[ids.length];
int j = 0;
for (int i : ids) {
    res[j++] = Integer.toString(i);
return res;
StringintsToString(int ints[])
ints To String
if (ints == null) {
    return "";
StringBuilder str = new StringBuilder();
for (int i = 0; i < ints.length; i++) {
    str.append(ints[i]);
    if (i < ints.length - 1) {
        str.append(" ");
...
StringintsToString(int[] ary)
Converts an array of numbers to a string.
if (ary == null || ary.length == 0)
    return "";
final StringBuffer sb = new StringBuffer(50);
for (int j = 0; j < ary.length; ++j) {
    if (j > 0)
        sb.append(',');
    sb.append(ary[j]);
return sb.toString();
StringintsToString(int[] b)
Prints a int[] as a string separated by ".", if the string is to short the default is "0.0.0.0"
if (b.length < 4) {
    return "0.0.0.0";
return String.format("%d.%d.%d.%d", b[0], b[1], b[2], b[3]);