首页 > 代码库 > 随机生成手机号码
随机生成手机号码
public static void main ( String[] args ) { Test t = new Test(); for (int i = 0; i < 100; i++) //随机生成100个手机号码 { System.out.println(t.getPhone()); } } /** * 随机生成11位手机号码 */ public String getPhone(){ String 移动[]={"134","135","136","137","138","139","150","151","152","157","158","159","187","188"}; String 联通[]={"130","131","132","155","156","185","186","145"}; String 电信[]={"133","153","180","181","189"}; String tel[][]={移动,联通,电信}; Random rd=new Random(); int index = rd.nextInt(tel.length);//运营商个数 int size = rd.nextInt(tel[index].length); //各运营商号码个数 String phone=tel[index][size]+""+rd.nextInt(10)+""+rd.nextInt(10)+""+rd.nextInt(10)+""+rd.nextInt(10)+""+rd.nextInt(10)+""+rd.nextInt(10)+""+rd.nextInt(10)+""+rd.nextInt(10); return phone; }
随机生成手机号码
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。