code: public static ValidationResult validatePackageName(String packageName)
     {
        if (Strings.isNullOrEmpty(packageName))
           return new ValidationResult(ERROR, Messages.notNullOrEmpty(PACKAGE_NAME));
        int indexOfDot = packageName.indexOf(".");
        if (indexOfDot == -1)
        {
           return validateIdentifier(packageName, PACKAGE_NAME);
        }
        else if (indexOfDot == 0)
        {
           return new ValidationResult(ERROR, "The package name must not start with a '.'");
        }
        else if (packageName.charAt(packageName.length() - 1) == '.')
        {
           return new ValidationResult(ERROR, "The package name must not end with a '.'");
        }
        else
        {
           String[] names = packageName.split("[.]");
           for (String name : names)
           {
              if (Strings.isNullOrEmpty(name))
              {
                 return new ValidationResult(ERROR, Messages.isInvalidPackageName(packageName));
              }
              ValidationResult result = validateIdentifier(name, PACKAGE_NAME);
              if (!result.getType().equals(ResultType.INFO))
              {
                 return result;
              }
           }
        }
        return new ValidationResult(INFO);
     }
docs: Validates whether the <code>packageName</code> parameter is a valid package name. Note - this method does not
  verify if the default package is valid or not.
  
  @param packageName
  @return