code: public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
        throws RemoteException {
      // Get the CustomTargetingService.
      CustomTargetingServiceInterface customTargetingService =
          adManagerServices.get(session, CustomTargetingServiceInterface.class);
  
      // Get all custom targeting keys.
      List<Long> customTargetingKeyIds = getAllCustomTargetingKeyIds(adManagerServices, session);
  
      // Create a statement to get all custom targeting values for a custom
      // targeting key.
      StatementBuilder statementBuilder =
          new StatementBuilder()
              .where("customTargetingKeyId = :customTargetingKeyId")
              .orderBy("id ASC")
              .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
  
      int totalResultsCounter = 0;
  
      for (Long customTargetingKeyId : customTargetingKeyIds) {
        // Set the custom targeting key ID to select from.
        statementBuilder.withBindVariableValue("customTargetingKeyId", customTargetingKeyId);
  
        // Default for total result set size and offset.
        int totalResultSetSize = 0;
        statementBuilder.offset(0);
  
        do {
          // Get custom targeting values by statement.
          CustomTargetingValuePage page =
              customTargetingService.getCustomTargetingValuesByStatement(
                  statementBuilder.toStatement());
  
          if (page.getResults() != null) {
            totalResultSetSize = page.getTotalResultSetSize();
            for (CustomTargetingValue customTargetingValue : page.getResults()) {
              System.out.printf(
                  "%d) Custom targeting value with ID %d, belonging to key "
                      + "with ID %d, name '%s' and display name '%s' was found.%n",
                  totalResultsCounter++,
                  customTargetingValue.getId(),
                  customTargetingValue.getCustomTargetingKeyId(),
                  customTargetingValue.getName(),
                  customTargetingValue.getDisplayName());
            }
          }
  
          statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
        } while (statementBuilder.getOffset() < totalResultSetSize);
      }
  
      System.out.printf("Number of results found: %d%n", totalResultsCounter);
    }
docs: Runs the example.
  
  @param adManagerServices the services factory.
  @param session the session.
  @throws ApiException if the API request failed with one or more service errors.
  @throws RemoteException if the API request failed due to other errors.