package com.fuyuanshen.web;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

public class PhoneNumberGenerator {
    public static void main(String[] args) {
        // 定义江西上饶的134号段（共22个）
        String[] prefixes = {
                "1340703", "1340793", "1342650", "1342651", "1342663",
                "1342664", "1342665", "1343703", "1343793", "1347901",
                "1347902", "1347903", "1347930", "1347931", "1347932",
                "1347933", "1347934", "1347935", "1347936", "1347937",
                "1347938", "1347939"
        };

        // 输出到控制台
        System.out.println("江西上饶134号段完整手机号码（共2200个）：");
        for (String prefix : prefixes) {
            for (int i = 0; i < 100; i++) {
                String middle = String.format("%02d", i); // 生成00-99的中间数字
                System.out.println(prefix + middle + "51");
            }
        }

        // 同时输出到文件（可选）
        try (BufferedWriter writer = new BufferedWriter(new FileWriter("shangrao_phones.txt"))) {
            for (String prefix : prefixes) {
                for (int i = 0; i < 100; i++) {
                    String middle = String.format("%02d", i);
                    writer.write(prefix + middle + "51");
                    writer.newLine();
                }
            }
            System.out.println("\n同时已保存到文件：shangrao_phones.txt");
        } catch (IOException e) {
            System.err.println("文件写入错误：" + e.getMessage());
        }
    }
}