public boolean validate(String value){
  int index=value.indexOf('@');
  if (index == -1) {
    return false;
  }
  String name=value.substring(0,index);
  String domain=value.substring(index + 1,value.length());
  return validateName(name) && validateDomain(domain);
}

public boolean validate ( String value ) { int index = value . indexOf ( '@' ) ; if ( index == - 1 ) { return false ; } String name = value . substring ( 0 , index ) ; String domain = value . substring ( index + 1 , value . length ( ) ) ; return validateName ( name ) && validateDomain ( domain ) ; }
validates an email address .
