Here you can find the source of arrayToString(Object[] array)
Parameter | Description |
---|---|
array | The array to convert to a string. |
N.B. This method assumes the array values have toString() methods.
public static String arrayToString(Object[] array)
//package com.java2s; /* Please see the license information at the end of this file. */ public class Main { /**//from w w w . j a v a 2 s . c o m * Convert array contents to string. * * @param array * The array to convert to a string. * * @return Array entries as a string. * * <p> * N.B. This method assumes the array values have toString() * methods. * </p> */ public static String arrayToString(Object[] array) { String result = ""; if ((array != null) && (array.length > 0)) { for (int i = 0; i < array.length; i++) { Object value = array[i]; if (i > 0) result = result + ", "; if (value == null) { result = result + "null"; } else { result = result + value.toString(); } } } return result; } }