code: public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
        throws RemoteException {
      PackageServiceInterface packageService =
          adManagerServices.get(session, PackageServiceInterface.class);
  
      // Create a statement to select packages.
      StatementBuilder statementBuilder = new StatementBuilder()
          .where("status = :status")
          .orderBy("id ASC")
          .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
          .withBindVariableValue("status", PackageStatus.IN_PROGRESS.toString());
  
      // Retrieve a small amount of packages at a time, paging through
      // until all packages have been retrieved.
      int totalResultSetSize = 0;
      do {
        PackagePage page =
            packageService.getPackagesByStatement(statementBuilder.toStatement());
  
        if (page.getResults() != null) {
          // Print out some information for each package.
          totalResultSetSize = page.getTotalResultSetSize();
          int i = page.getStartIndex();
          for (Package pkg : page.getResults()) {
            System.out.printf(
                "%d) Package with ID %d, name '%s', and proposal ID %d was found.%n",
                i++,
                pkg.getId(),
                pkg.getName(),
                pkg.getProposalId()
            );
          }
        }
  
        statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
      } while (statementBuilder.getOffset() < totalResultSetSize);
  
      System.out.printf("Number of results found: %d%n", totalResultSetSize);
    }
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.