code: public static void runExample(
        AdManagerServices adManagerServices,
        AdManagerSession session,
        long productPackageId,
        long productId)
        throws RemoteException {
      ProductPackageItemServiceInterface productPackageItemService =
          adManagerServices.get(session, ProductPackageItemServiceInterface.class);
  
      // Create a local product package item.
      ProductPackageItem productPackageItem = new ProductPackageItem();
  
      // Set the product from which the product package item is created.
      productPackageItem.setProductId(productId);
  
      // Set the product package that the product package item belongs to.
      productPackageItem.setProductPackageId(productPackageId);
  
      // Specify if the product package item is required for this product package.
      productPackageItem.setIsMandatory(true);
  
      // Create the product package item on the server.
      ProductPackageItem[] productPackageItems =
          productPackageItemService.createProductPackageItems(
              new ProductPackageItem[] {productPackageItem});
  
      for (ProductPackageItem createdProductPackageItem : productPackageItems) {
        System.out.printf(
            "A product package item with ID %d created from "
                + "product ID %d belonging to "
                + "product package with ID %d was created.%n",
            createdProductPackageItem.getId(),
            createdProductPackageItem.getProductId(),
            createdProductPackageItem.getProductPackageId());
      }
    }
docs: Runs the example.
  
  @param adManagerServices the services factory.
  @param session the session.
  @param productPackageId the ID of the product package to add product package items to.
  @param productId the ID of the product to generate a product package item from.
  @throws ApiException if the API request failed with one or more service errors.
  @throws RemoteException if the API request failed due to other errors.