String getPassword Accessor Method

Send Snippet To: Save this snippet to Code Collector Pro -- view all bassglider's snippets
language: Java
license: Other

Code for Snippet:

                
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;
}
comments powered by Disqus

Info

Link to this snippet:


Download to Code Collector

To use the direct link to your snippet on CodeCollector.net either copy the html from the above section or drag the Download to Code Collector to where you would like to use it.

More Info:

Times Viewed: 726
Date Added: 2008-03-19 03:02:21
Last Modified: 0000-00-00 00:00:00

Web Analytics