groups

Link to this snippet:


Download to Code Collector

language: Java
licence: Other

String getPassword Accessor Method

options: send to code collectorview all bassglider's snippets
public String getPassword() {
	if (this.password.length() == 0) {
		for (int x = 1; x < 8; x  ) {
			int random = (int) (Math.random() * (10   26   26));
			if (random < 10) {  //add a digit
				password  = random;
			} else if (random < 36) { //add an uppercase letter
				password  = (char) ('A'   (random - 10));
			} else {  //add lowercase
				password  = (char) ('a'   (random - 36));
			}
		} return this.password;
	} return this.password;
}