code: public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
        throws RemoteException {
      // Get the InventoryService.
      InventoryServiceInterface inventoryService =
          adManagerServices.get(session, InventoryServiceInterface.class);
  
      // Create a statement to select all ad unit sizes.
      StatementBuilder statementBuilder = new StatementBuilder();
  
      // Get all ad unit sizes.
      AdUnitSize[] adUnitSizes =
          inventoryService.getAdUnitSizesByStatement(statementBuilder.toStatement());
  
      if (adUnitSizes != null) {
        for (int i = 0; i < adUnitSizes.length; i++) {
          AdUnitSize adUnitSize = adUnitSizes[i];
          System.out.printf(
              "%d) Ad unit size of dimensions '%s' was found.%n",
              i, adUnitSize.getFullDisplayString());
        }
      } else {
        System.out.println("No ad unit sizes found.");
      }
    }
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.