List of utility methods to do Array Print
void | printArray(int[] array) print Array for (int i : array) { System.out.print(i + " "); System.out.println(); |
String | printArray(int[] array) Pretty prints an array of ints as a string. StringBuilder result = new StringBuilder("["); for (int i = 0; i < array.length; i++) { result.append(array[i]).append((i < (array.length - 1)) ? ", " : ""); result.append(']'); return result.toString(); |
void | printArray(int[] array) print Array System.out.print("{"); for (int i = 0; i < array.length; i++) { System.out.print(array[i]); if (i < array.length - 1) { System.out.print(", "); System.out.println("}"); ... |
void | printArray(int[] array) print Array System.out.println(Arrays.toString(array)); |
void | printArray(int[] array) print Array boolean firstFlag = true; StringBuffer logBuffer = new StringBuffer(); for (int i : array) { if (firstFlag) { logBuffer.append("[" + i); firstFlag = false; } else { logBuffer.append(", " + i); ... |
void | printArray(int[] array) print Array for (int i = 0; i < array.length; i++) { System.out.print(array[i] + ", "); System.out.println(); |
void | printArray(int[] array, int start, int end) print Array System.out.print("array: [" + start + "," + end + "]"); for (int i = start; i < end; i++) { System.out.print("," + array[i]); System.out.println(""); |
void | printArray(int[] nums) print Array for (int i : nums) { System.out.print(i + ", "); System.out.println(); |
void | printArray(Object a[]) Prints the contents of the array. for (int i = 0; i < a.length; i++) System.out.print(a[i].toString() + " "); |
String | printArray(Object[] arr) Prints an array of stuff, with the notation {x1,x2,x3...,xn}, or "" if the array is empty. String toPrint = ""; if (arr.length > 0) { toPrint = "{"; for (int i = 0; i < arr.length; i++) { toPrint += arr[i].toString(); if (i < arr.length - 1) toPrint += ","; toPrint += "}"; return toPrint; |