class StringBuilderTest
{
public static void main(String[] args)
{
int[] arr = {3,6,7,87,9};
String s =arrayToString(arr);
System.out.println("s="+s);
}
public static String arrayToString(int[] arr)
{
String str = "[";
for (int i =0;i<arr.length ;i++ )
{
if(i!=arr.length-1)
str+= arr[i]+",";
else
str+= "]";
}
return str;
}
}
|
|