1
0

新增设备分组

This commit is contained in:
2025-08-13 19:29:04 +08:00
parent 72cab138a7
commit 1af4b165f2
11 changed files with 305 additions and 16 deletions

View File

@ -0,0 +1,41 @@
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());
}
}
}