int[] arr = {1,3,6,10,15,2,5,9,14,4,8,13,7,12,11};
int i = 0; //使用while遍历
while(i < arr.length){
if(i != arr.length - 1){
System.out.print(arr[i]+",");
}else{
System.out.print(arr[i]);
}
++i;
}
/**
* 下面使用for遍历
**/
for(int j = 0; j < arr.length; j++){
if(j != arr.length - 1){
System.out.print(arr[j]+",");
}else{
System.out.print(arr[j]);
}
}