Java tutorial
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; import android.util.Log; public class Main { private static final String TAG = "TravelUtil"; public static boolean isShort(String password) { if (password == null || password.equals("")) { Log.d(TAG, "password is null"); return false; } String strPattern = "^[0-9A-Za-z]{6,}$"; Pattern p = Pattern.compile(strPattern); Matcher m = p.matcher(password); return m.matches(); } }