@Test
public void test5(){
try {
BufferedReader br=new BufferedReader(new FileReader("D:\\a.txt"));
BufferedWriter bw=new BufferedWriter(new FileWriter("D:\\b.txt"));
String line="";
while((line=br.readLine())!=null){
char[] li=line.toCharArray();
Arrays.sort(li);
System.out.println(li);
bw.write(li);
bw.flush();
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |