模拟生成手机号
程序员文章站
2022-03-04 15:53:27
...
public static void main(String[] args) {
for(int j = 0; j <= 99999999; j++) {
String phone = getHourFreq(j+"");
if(j % 10000 == 0) {
System.out.println(186+phone);
}
}
}
public static String getHourFreq(String str) {
byte[] hourArray = new byte[8-str.length()];
return bytesToString(hourArray)+str;
}
private static String bytesToString(byte[] bArray) {
StringBuffer sb = new StringBuffer();
for (byte b : bArray)
{
sb.append(b);
}
return sb.toString();
}