code: public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
        throws RemoteException {
      CompanyServiceInterface companyService =
          adManagerServices.get(session, CompanyServiceInterface.class);
  
      // Create a statement to select companies.
      StatementBuilder statementBuilder =
          new StatementBuilder()
              .where("type = :type")
              .orderBy("id ASC")
              .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
              .withBindVariableValue("type", CompanyType.ADVERTISER.toString());
  
      // Retrieve a small amount of companies at a time, paging through
      // until all companies have been retrieved.
      int totalResultSetSize = 0;
      do {
        CompanyPage page = companyService.getCompaniesByStatement(statementBuilder.toStatement());
  
        if (page.getResults() != null) {
          // Print out some information for each company.
          totalResultSetSize = page.getTotalResultSetSize();
          int i = page.getStartIndex();
          for (Company company : page.getResults()) {
            System.out.printf(
                "%d) Company with ID %d, name '%s', and type '%s' was found.%n",
                i++, company.getId(), company.getName(), company.getType());
          }
        }
  
        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.