你可以用for循环将数组的每个元素进行类型转换,给你一个例子,你可以参考一下:
public class TextSuper {
static String arr2String(int [] arr){
StringBuilder strb=new StringBuilder();
for(int x:arr)
strb.append(x);
return strb.toString();
}
public static void main(String args[]){
int [] i =new int []{1,2,3,4,5,6};
String x=arr2String(i);
System.out.println(x);
}
} |