public static Pmtiles.Entry findTile(List<Pmtiles.Entry> entries, long tileId) {
    int m = 0;
    int n = entries.size() - 1;
    while (m <= n) {
      int k = (n + m) >> 1;
      long cmp = tileId - entries.get(k).tileId();
      if (cmp > 0) {
        m = k + 1;
      } else if (cmp < 0) {
        n = k - 1;
      } else {
        return entries.get(k);
      }
    }
    if (n >= 0 && (entries.get(n).runLength() == 0 || tileId - entries.get(n).tileId() < entries.get(n).runLength())) {
      return entries.get(n);
    }
    return null;
  }
Finds the relevant entry for a tileId in a list of entries.
<p>
If there is an exact match for tileId, return that. Else if the tileId matches an entry's tileId + runLength,
return that. Else if the preceding entry is a directory (runLength = 0), return that. Else return null.
planetiler-core/src/main/java/com/onthegomap/planetiler/pmtiles/ReadablePmtiles.java