package org.jimmy.demo2;
import java.util.Arrays;
/**
* @Author: Administrator
* @CreateTime: 2018-12-25 21:59
*/
public class StringDemo6 {
public static void main(String[] args) {
int[] arr={1,2,3};//将数组按照[1,2,3]形式输出
String s="[";
for (int i = 0; i < arr.length; i++) {
if(i<arr.length-1){
s+=arr[i]+",";
}else{
s+=arr[i]+"]";
}
}
System.out.println(Arrays.toString(arr));
}
}
[1, 2, 3]