public static void writeFile() {
File f = new File("E:\\test.sql");
f.toString();
StringBuffer stringBuffer = new StringBuffer();
String sql11 ="INSERT INTO `XXX` (A,B) VALUES ('867726030000048', '2863');\r\n";
for(int i=0;i<=2000000;i++) {
stringBuffer.append(sql11);
}
String content=stringBuffer.toString();
FileWriter fw=null;
BufferedWriter bw=null;
try{
if(!f.exists()){
f.createNewFile();
}
fw=new FileWriter(f.getAbsoluteFile(),true); //true表示可以追加新内容
//fw=new FileWriter(f.getAbsoluteFile()); //表示不追加
bw=new BufferedWriter(fw);
bw.write(content);
bw.close();
}catch(Exception e){
e.printStackTrace();
}
}