随机生成九位数字

public static void main(String[] args) {

Random random = new Random();
String s = random.nextInt(999999999)+ "";
StringBuffer stringBuffer = new StringBuffer();
for (int i = 0; i < 9-s.length(); i++) {
stringBuffer.append("0");
}
s=stringBuffer.toString()+s;

System.out.println(s);


}
posted @ 2023-06-15 15:43  霍叔  阅读(295)  评论(0编辑  收藏  举报