Java examples for Security:Password
generate Password
//package com.java2s; import java.util.Random; public class Main { public static void main(String[] argv) throws Exception { System.out.println(generatePass()); }//from www . j a v a 2 s. com public static String generatePass() { StringBuilder sb = new StringBuilder(); char c; Random rnd = new Random(); for (int i = 0; i < 12; i++) { c = (char) ((rnd.nextInt(128 - 32)) + 32); sb.append(c); } return sb.toString(); } }