public static boolean isValidEmail(String email){
  final String emailPattern="^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
  Matcher matcher;
  Pattern pattern=Pattern.compile(emailPattern);
  matcher=pattern.matcher(email);
  if (matcher != null)   return matcher.matches();
 else   return false;
}

public static boolean isValidEmail ( String email ) { final String emailPattern = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$" ; Matcher matcher ; Pattern pattern = Pattern . compile ( emailPattern ) ; matcher = pattern . matcher ( email ) ; if ( matcher != null ) return matcher . matches ( ) ; else return false ; }
checks if the input parameter is a valid email .
