code: public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
        throws RemoteException {
      // Get the NetworkService.
      NetworkServiceInterface networkService =
          adManagerServices.get(session, NetworkServiceInterface.class);
  
      // Get all networks that you have access to with the current authentication
      // credentials.
      Network[] networks = networkService.getAllNetworks();
  
      if (networks == null || networks.length == 0) {
        System.out.printf("No accessible networks found.%n");
        return;
      }
  
      int i = 0;
      for (Network network : networks) {
        System.out.printf(
            "%d) Network with network code '%s' and display name '%s' was found.%n",
            i++, network.getNetworkCode(), network.getDisplayName());
      }
  
      System.out.printf("Number of networks found: %d%n", networks.length);
    }
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.