This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes Re: password policy Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Re: password policy" Watch "Re: password policy" New topic

Re: password policy

Joe Cheung
Ranch Hand

Joined: Oct 18, 2002
Posts: 104
Dear all,

How can I implement my own password policy that the password must consists of at least one character (a-z or A-Z) and one numeric value (0-9) in Java?


Tom Tremain

Joined: May 09, 2005
Posts: 1
A good place to start would be to read the javadocs for the the isDigit(char ch) and isLetter(char ch) static methods of the java.lang.Character class.

Using these methods inside of a loop should enable you to verify that a password meets the security requirements defined in your post.
Stuart Gray
Ranch Hand

Joined: Apr 21, 2005
Posts: 410
Yosi Hendarsjah
Ranch Hand

Joined: Oct 02, 2003
Posts: 164
You can use regular expression.
I agree. Here's the link:
subject: Re: password policy