List数组怎么转换成int[]数组? 比如 List list = new ArrayList();
 int suoyins[];怎么把list中的值放入int数组中.怎么转换啊?

解决方案 »

  1.   

    使用List的如下方法<T> T[] toArray(T[] a)
      

  2.   

            List<Integer> list = new ArrayList<Integer>();
            int[] a = new int[list.size()];
            for(int i=0;i<list.size();i++)
            {
                a[i] = list.get(i);
            }
      

  3.   

    int数组得先给定长度,就用list的length方法获得长度给int数组。
      

  4.   

    我写了的转换不过来在Myeclipse中报错.下面显示红线编译都没通过啊.
      

  5.   

    我写了的转换不过来在Myeclipse中报错.下面显示红线编译都没通过啊.
      

  6.   

    你引的包对么?
    import java.util.List;