If you wanna go a little crazy, there's a more obnoxious way to do this that runs in O(set bits) size vs. O(table size).

```
long set = referencedStaticHeaders;
while (toEmit != 0) {
  long toEmitBit = Long.lowestOneBit(set);
  int toEmitIndex = numberOfTrailingZeros(toEmitBit);
  set = set & ~toEmitBit;
  emittedHeaders.add(STATIC_HEADER_TABLE[toEmitIndex].name);
  emittedHeaders.add(STATIC_HEADER_TABLE[toEmitIndex].value);
}
```

This sample code is not tested.