public boolean validate(String domain){
  StringTokenizer tok;
  tok=new StringTokenizer(domain,".");
  if (tok.countTokens() <= 1) {
    return false;
  }
  while (tok.hasMoreTokens()) {
    if (!isValidDomainPart(tok.nextToken())) {
      return false;
    }
  }
  return true;
}

public boolean validate ( String domain ) { StringTokenizer tok ; tok = new StringTokenizer ( domain , "." ) ; if ( tok . countTokens ( ) <= 1 ) { return false ; } while ( tok . hasMoreTokens ( ) ) { if ( ! isValidDomainPart ( tok . nextToken ( ) ) ) { return false ; } } return true ; }
determines if the domain is valid
