Here you can find the source of printArray(int[] array)
public static void printArray(int[] array)
//package com.java2s; //License from project: Open Source License public class Main { public static void printArray(int[] array) { boolean firstFlag = true; StringBuffer logBuffer = new StringBuffer(); for (int i : array) { if (firstFlag) { logBuffer.append("[" + i); firstFlag = false;//from w ww. jav a2 s. co m } else { logBuffer.append(", " + i); } } logBuffer.append("]"); System.out.println(logBuffer.toString()); } }