Subversion Repositories Integrator Subversion

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
224 espaco 1
package br.com.ec.shared;
2
 
3
public class SharedComponente {
4
 
5
        public static String gerarSenha(int qtdeMaximaCaracteres){
6
            String[] caracteres = { "0", "1", "b", "2", "4", "5", "6", "7", "8",
7
                        "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
8
                        "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w",
9
                        "x", "y", "z"};
10
 
11
                StringBuilder senha = new StringBuilder();
12
 
13
        for (int i = 0; i < qtdeMaximaCaracteres; i++) {
14
            int posicao = (int) (Math.random() * caracteres.length);
15
            senha.append(caracteres[posicao]);
16
        }
17
        return senha.toString();
18
        }
19
 
20
        public static void main(String[] args) {
21
                System.out.println(gerarSenha(6));
22
        }
23
 
24
}