List of utility methods to do Array Print
void | printArray(Object[] array) Prints the elements of the array, one per line, enclosed between *- and -*, except with the first line enclosed with 0- and -0. if (array == null) { System.out.println("null array"); return; if (array.length == 0) { System.out.println("zero-length array"); return; System.out.println("0-" + array[0].toString() + "-0"); for (int i = 1; i < array.length; i++) { System.out.println("*-" + array[i].toString() + "-*"); |
void | printArray(Object[] array) Print an array to console. String className = array[0].getClass().toString(); System.out.print(className.substring(className.lastIndexOf(".") + 1, className.length()) + " Array: ["); for (int i = 0; i < array.length; i++) { System.out.print(array[i]); if (i != array.length - 1) { System.out.print(", "); System.out.println("]"); |
String | printArray(Object[] cells) print Array if (cells == null) { return "empty"; StringBuffer buffer = new StringBuffer(); for (int i = 0; i < cells.length; i++) { if (i > 0) { buffer.append(", "); buffer.append(cells[i]); return buffer.toString(); |
void | printArray(Object[] o) Prints an array with values separated by commas. for (int i = 0; i < o.length; i++) { System.out.print(o[i]); if (i < o.length - 1) System.out.print(", "); System.out.println(); |
String | printArray(Object[] strArray, String split) print Array String result = ""; for (int i = 0; i < strArray.length - 1; i++) { result += String.valueOf(strArray[i]) + split; result += strArray[strArray.length - 1]; return result; |
void | printArray(String arrayLabel, Object[] array) Debugging support -- Print contents of an array. if (array == null) { System.out.println(arrayLabel + " is null."); } else if (array.length == 0) { System.out.println(arrayLabel + " is empty."); } else { System.out.println(arrayLabel); for (int i = 0; i < array.length; i++) { Object value = array[i]; ... |
String | printArray(String[] arr, char separator) print string array with specific separator StringBuilder buf = new StringBuilder(); for (String s : arr) buf.append(s).append(separator); if (buf.length() > 0) buf.deleteCharAt(buf.length() - 1); return buf.toString(); |
String | printArray(String[] s) Return a representation of a String array in the format of "['{1}','{2}',...]". StringBuffer sb = new StringBuffer("["); if (s == null) sb.append("null"); else for (int i = 0; i < s.length; i++) sb.append(i == 0 ? "" : ",").append('"').append(s[i]).append('"'); return sb.append("]").toString(); |
void | printArray(String[] s) Affiche un array for (int i = 0; i < s.length; i++) { System.out.println(i + ". " + s[i]); |
void | printArray(T[] arr) print Array for (T t : arr) {
System.out.print(t);
System.out.println();
|