code: private static void createAdsWithCustomizations(AdWordsServicesInterface adWordsServices,
        AdWordsSession session, List<Long> adGroupIds, String feedName) throws RemoteException {
      // Get the AdGroupAdService.
      AdGroupAdServiceInterface adGroupAdService =
          adWordsServices.get(session, AdGroupAdServiceInterface.class);
  
      ExpandedTextAd textAd = new ExpandedTextAd();
      textAd.setHeadlinePart1(String.format("Luxury Cruise to {=%s.Name}", feedName));
      textAd.setHeadlinePart2(String.format("Only {=%s.Price}", feedName));
      textAd.setDescription(String.format("Offer ends in {=countdown(%s.Date)}!", feedName));
      textAd.setFinalUrls(new String[] {"http://www.example.com"});
  
      // We add the same ad to both ad groups. When they serve, they will show different values, since
      // they match different feed items.
      List<AdGroupAdOperation> adGroupAdOperations = new ArrayList<>();
      for (Long adGroupId : adGroupIds) {
        AdGroupAd adGroupAd = new AdGroupAd();
        adGroupAd.setAdGroupId(adGroupId);
        adGroupAd.setAd(textAd);
  
        AdGroupAdOperation adGroupAdOperation = new AdGroupAdOperation();
        adGroupAdOperation.setOperand(adGroupAd);
        adGroupAdOperation.setOperator(Operator.ADD);
  
        adGroupAdOperations.add(adGroupAdOperation);
      }
  
      AdGroupAdReturnValue adGroupAdReturnValue = adGroupAdService.mutate(
          adGroupAdOperations.toArray(new AdGroupAdOperation[adGroupAdOperations.size()]));
  
      for (AdGroupAd addedAd : adGroupAdReturnValue.getValue()) {
        System.out.printf("Created an ad with ID %d, type '%s' and status '%s'.%n",
            addedAd.getAd().getId(), addedAd.getAd().getAdType(), addedAd.getStatus());
      }
    }
docs: Creates expanded text ads that use ad customizations for the specified ad group IDs.