private static int interleave(int tx) {
    tx = (tx | (tx << 8)) & 0x00FF00FF;
    tx = (tx | (tx << 4)) & 0x0F0F0F0F;
    tx = (tx | (tx << 2)) & 0x33333333;
    tx = (tx | (tx << 1)) & 0x55555555;
    return tx;
  }
Fast hilbert space-filling curve implementation ported from C++
<a href="https://github.com/rawrunprotected/hilbert_curves">github.com/rawrunprotected/hilbert_curves</a> by
<a href="https://threadlocalmutex.com/">threadlocalmutex.com</a> (public domain).
planetiler-core/src/main/java/com/onthegomap/planetiler/util/Hilbert.java