code: private static long getTrackCount(CdjStatus.TrackSourceSlot slot, Client client, int playlistId) throws IOException {
          Message response;
          if (playlistId == 0) {  // Form the proper request to render either all tracks or a playlist
              response = client.menuRequest(Message.KnownType.TRACK_MENU_REQ, Message.MenuIdentifier.MAIN_MENU,
                      slot, NumberField.WORD_0);
          }
          else {
              response = client.menuRequest(Message.KnownType.PLAYLIST_REQ, Message.MenuIdentifier.MAIN_MENU, slot,
                      NumberField.WORD_0, new NumberField(playlistId), NumberField.WORD_0);
          }
  
          return response.getMenuResultsCount();
      }
docs: Find out how many tracks are present in a playlist (or in all tracks, if {@code playlistId} is 0) without
  actually retrieving all the entries. This is used in checking whether a metadata cache matches what is found
  in a player slot, and to set up the context for sampling a random set of individual tracks for deeper
  comparison.
  
  @param slot the player slot in which the media is located that we would like to compare
  @param client the player database connection we can use to perform queries
  @param playlistId identifies the playlist we want to know about, or 0 of we are interested in all tracks
  @return the number of tracks found in the player database, which is now ready to enumerate them if a positive
  value is returned
  
  @throws IOException if there is a problem communicating with the database server