String str="abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ0123456789"; Random r=new Random(); String arr[]=new String [4]; String b=""; for(int i=0;i<4;i++) { int n=r.nextInt(62); arr[i]=str.substring(n,n+1); b+=arr[i]; } System.out.print("验证码:"+b);
时间: 2024-10-09 22:30:48