Here you can find the source of validateEmail(String email)
public static boolean validateEmail(String email)
//package com.java2s; //License from project: Apache License import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { private static final String EMAIL_PATTERN = ".+@.+\\.[a-z]+"; private static final int EMAIL_MAX_LENGTH = 256; public static boolean validateEmail(String email) { boolean isValid = false; Pattern emailPattern = Pattern.compile(EMAIL_PATTERN); Matcher m = emailPattern.matcher(email); if ((email.length() <= EMAIL_MAX_LENGTH) && (m.matches())) { isValid = true;//from ww w.j ava2 s. c om } return isValid; } }