package org.stepic.droid.util;

public class ValidatorUtil {
    public static final int MIN_PASSWORD_LENGTH = 6;

    public static boolean isPasswordValid(String password) {
        return password != null && password.length() >= MIN_PASSWORD_LENGTH;
    }

    public static boolean isPasswordLengthValid(int passwordLength){
        return passwordLength >= MIN_PASSWORD_LENGTH;
    }

}
package org.stepic.droid.util;

import org.jetbrains.annotations.Nullable;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ValidatorUtil {
    public static final int MIN_PASSWORD_LENGTH = 6;

    public static boolean isPasswordValid(String password) {
        return password != null && password.length() >= MIN_PASSWORD_LENGTH;
    }

    public static boolean isPasswordLengthValid(int passwordLength) {
        return passwordLength >= MIN_PASSWORD_LENGTH;
    }

    public static boolean isEmailValid(@Nullable String email) {
        if (email == null || email.isEmpty()) return false;
        String regex = "^[\\w!#$%&'*+/=?`{|}~^-]+(?:\\.[\\w!#$%&'*+/=?`{|}~^-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,6}$";
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(email);
        return matcher.matches();
    }

}
add e-mail validator