Java 随机生成任意组手机电话号码

Java随机生成11位手机电话号码,只需两行代码
 

public class Main {
    public static void main(String[] args) {
        String[] start = {"130", "131", "132", "133", "134", "150", "151", "155", "158", "166", "180", "181", "184", "185", "188"};
        System.out.println(start[(int) (Math.random() * start.length)]+(10000000+(int)(Math.random()*(99999999-10000000+1))));
    }
}

猜你喜欢

转载自blog.csdn.net/qq_33613696/article/details/130429835