Using regular for loop is the simplest way of printing array in my opinion. Here you have a sample code based on your intArray
for (int i = 0; i < intArray.length; i++) {
System.out.print(intArray[i] + ", ");
}
It gives output as yours 1, 2, 3, 4, 5