import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class TestQQ3 {
public static void main(String[] args) {
try {
//1创建一个总的文件夹qqmainl
File file = new File("d:\\qqmail");
if (!file.exists()) {
file.mkdirs();
}
//2 创建对应的qq邮箱.text文本文件
File f = new File("d:\\qqmail\\qqmail.txt");
if (!f.exists()) {
f.createNewFile();
}
FileWriter fw = null;
fw = new FileWriter(f);
BufferedWriter out = new BufferedWriter(fw);
long len = 99999999999L; //11位qq
//int len = 987600;
StringBuilder sb = new StringBuilder();
for(long i=9999;i<len;i++){
sb.append(i+"@qq.com;");
if(i%15==0){
sb.append("\n");
}
if(i%400==0){
sb.append("\n"+i+"*************************************************\n");
System.out.println("sb.toString().length()= "+sb.toString().length());
out.write(sb.toString(), 0, sb.toString().length() - 1);
//清楚上次累加的,否则内存出错。
sb.delete(0, sb.toString().length()-1);
}
}
out.close();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("end");
}
}
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class TestQQ3 {
public static void main(String[] args) {
try {
//1创建一个总的文件夹qqmainl
File file = new File("d:\\qqmail");
if (!file.exists()) {
file.mkdirs();
}
//2 创建对应的qq邮箱.text文本文件
File f = new File("d:\\qqmail\\qqmail.txt");
if (!f.exists()) {
f.createNewFile();
}
FileWriter fw = null;
fw = new FileWriter(f);
BufferedWriter out = new BufferedWriter(fw);
long len = 99999999999L; //11位qq
//int len = 987600;
StringBuilder sb = new StringBuilder();
for(long i=9999;i<len;i++){
sb.append(i+"@qq.com;");
if(i%15==0){
sb.append("\n");
}
if(i%400==0){
sb.append("\n"+i+"*************************************************\n");
System.out.println("sb.toString().length()= "+sb.toString().length());
out.write(sb.toString(), 0, sb.toString().length() - 1);
//清楚上次累加的,否则内存出错。
sb.delete(0, sb.toString().length()-1);
}
}
out.close();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("end");
}
}