日期:2014-05-20 浏览次数:20914 次
try { FileReader fr=new FileReader("a.txt"); BufferedReader br=new BufferedReader(fr); String s=""; List list=new ArrayList(); while((s=br.readLine())!=null)list.add(s); Collections.shuffle(list); FileWriter fw=new FileWriter("b.txt"); for(int i=0;i<list.size();i++)fw.write(list.get(i)+""); fw.close(); } catch (Exception e) { e.printStackTrace(); }