我有2号的int数组。 余万这个数字复制到数组列表,并打印出来。尽可能避免使用Integer结果[];Copystored数组值到数组列表JAVA
int result[] = {1024,2048};
List<Integer> res = new ArrayList<Integer>(result);
public class TEA {
/**
* @param args
*/
public static void main(String[] args) {
int result[] = {1024,2048};
List<int[]> res = Arrays.asList(result);
System.out.println(res);
}
}
output :[[[email protected]]
这是在新的值中添加,所以不能复制已有的阵列,而无需使用整数结果[]? – newbieprogrammer 2013-05-10 16:59:28
...我不确定你在说什么。这些,如果你想获得一个'INT []'的'名单',但目前还不清楚你的意思是什么本质上是唯一的选择,“这是在新的增值。” –
2013-05-10 17:02:21
哦,我得到了it..thanks 附:刚才看到了错误的代码。 – newbieprogrammer 2013-05-10 17:17:21