groups

name language licence
PHP Starter PHP Other
Java Starter Java Other
C Starter C Other
Objective-C Starter Objective-C Other
Boolean isLetterOrDigit Method Java Other
String getPassword Accessor Method Java Other
DerbyCar Java Other
Registration UH Username PHP Other



language: Java
licence: Other

String getPassword Accessor Method

options: view full snippetsend to code collector
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;
}
	
(Continues...)