Java tutorial
//package com.java2s; public class Main { public static final int PASSWORD_MIN_LENGTH = 6; public static final int PASSWORD_MAX_LENGTH = 20; public static boolean isPasswordMatches(String password) { int length = password.trim().length(); return length >= PASSWORD_MIN_LENGTH && length <= PASSWORD_MAX_LENGTH; } }