Here you can find the source of validateEmail(String email)
public static boolean validateEmail(String email)
//package com.java2s; import java.util.Collection; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static final Pattern EMAIL_PATTERN = Pattern.compile(".+@.+\\.[a-z]+"); public static boolean validateEmail(String email) { return validatePattern(email, EMAIL_PATTERN); }/*from ww w .j a v a2 s.co m*/ private static boolean validatePattern(String toBeValidated, Pattern pattern) { if (isEmpty(toBeValidated)) return false; Matcher m = pattern.matcher(toBeValidated); return m.matches(); } public static boolean isEmpty(Collection<?> collection) { return collection == null || collection.size() == 0; } public static boolean isEmpty(Map<?, ?> map) { return map == null || map.size() == 0; } public static boolean isEmpty(String s) { return s == null || s.trim().length() == 0; } public static boolean isEmpty(Object[] array) { return array == null || array.length == 0; } }