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

StringarrayToString(double d[])
array To String
String s = "";
for (int i = 0; i < d.length; i++) {
    s = s + df.format(d[i]);
    if (i < d.length - 1)
        s = s + ",";
return s;
StringarrayToString(double... a)
array To String
StringBuffer result = new StringBuffer();
if (a.length > 0) {
    result.append(a[0]);
    for (int i = 1; i < a.length; i++) {
        result.append(",");
        result.append(a[i]);
return "[" + result.toString() + "]";
StringarrayToString(double[] array)
array To String
StringBuffer sb = new StringBuffer();
for (int r = 0; r < array.length; r++) {
    sb.append(array[r] + ",");
return sb.toString();
StringarrayToString(double[] array, String separator)
array To String
int length = array.length;
if (length == 0)
    return "";
StringBuilder sb = new StringBuilder();
for (int i = 0; i < length; ++i) {
    sb.append(array[i]);
    if (i < length - 1)
        sb.append(separator);
...
StringarrayToString(double[] v)
array To String
return arrayToString(v, null);
StringarrayToString(double[] xs)
array To String
StringBuilder sb = new StringBuilder();
sb.append('[');
for (double x : xs) {
    if (sb.length() != 1)
        sb.append(", ");
    sb.append(x);
sb.append(']');
...
StringarrayToString(final byte[] array)
array To String
try {
    return new String(array, ASCII_CHARSET);
} catch (UnsupportedEncodingException e) {
    return null;
StringarrayToString(final byte[] array, final int start, final int length)
Convert the contents of the specified array to a String, starting at an offset of start, for length.
int i;
int count;
final byte[] temp;
count = 0;
temp = new byte[length];
for (i = start; i < (start + length); i++) {
    if ((array[i] >= 0) && (array[i] < 32)) {
        temp[count] = 32;
...
StringarrayToString(final float[] array)
Build a string from an array.
if (array.length == 0) {
    return "";
StringBuilder sb = new StringBuilder();
for (Float o : array) {
    sb.append(o.toString());
    sb.append('|');
sb.deleteCharAt(sb.length() - 1);
return sb.toString();
StringarrayToString(final Object[] a)
Converts the given array of Objects into a String.
if (a == null)
    return "null";
if (a.length == 0)
    return "";
final StringBuffer sb = new StringBuffer();
sb.append(a[0].toString());
for (int i = 1; i < a.length; i++) {
    sb.append(",");
...