HashSet hs=new HashSet();
怎么将hs中的内容转换为int型的数组

解决方案 »

  1.   

    得看这hs里面装的是什么类型,能不能转。如果装的Integer的话可以先转成Integer的数组Integer[] n=hs.toArray(new Integer[0]);然后,你可以创建个int的数组,把Integer的数组一个个拆箱装进去
      

  2.   

    写个方法就是了,这个又不是很难,而且你可以随便怎么排序,不要指望所有你需要的方法都用官方的API....