Android examples for java.security:Password
is Password Valid: 8-16 length and A-Z a-a and 0-9
import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main{ public static boolean isPswValid(String sequence) { if (!(sequence.length() >= 8 && sequence.length() <= 16)) { return false; }//from w w w . jav a 2 s . co m Pattern pattern = Pattern.compile("^([a-zA-Z0-9]){8,16}$"); Matcher matcher = pattern.matcher(sequence); return matcher.find(); } }