//文件写入
public static void writeFile(){
FileWriter fileWriter = null;
try {
//写入文件地址
fileWriter = new FileWriter("E:\\Result.txt");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
int [] a=new int[]{11112,222,333,444,555,666};
for (int i = 0; i < a.length; i++) {
try {
//写入
fileWriter.write(String.valueOf(a[i])+" ");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
try {
fileWriter.flush();
fileWriter.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private static String readerFile(){
//读取文件
String s, s2 = "";
try {
BufferedReader in = new BufferedReader(new FileReader
("E:/fe.txt"));
while ((s = in.readLine()) != null) {
s2 += s + "\n";
}
in.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println(s2);
return s2;
}