package arithmetic;import java.util.Random;public class Test04 {/*** 密码的自动生成器:密码由大写字母/小写字母/数字组成,生成12位随机密码;*/public static void main(String[] args) {char [] pardStore = new char[62];for (int i = 0; i < 26; i++) {pardStore[i]=(char)('A'+i);}for (int i = 26; i < 52; i++) {pardStore[i]=(char)('a'+(i-26));}for (int i = 52; i < 62; i++) {pardStore[i]=(char)('0'+(i-52));}Random r = new Random();for (int i = 0; i < 12; i++) {int n = r.nextInt(62);System.out.print(pardStore[n]);}}}
700字范文,内容丰富有趣,生活中的好帮手!