static int replicaIndex(int firstReplicaIndex, int secondReplicaShift, int replicaIndex, int nBrokers) {
        long shift = 1 + (secondReplicaShift + replicaIndex) % (nBrokers - 1);
        return (int) ((firstReplicaIndex + shift) % nBrokers);
    }
Given broker and rack information, returns a list of brokers alternated by the rack. Assume
this is the rack and its brokers:
<pre>
rack1: 0, 1, 2
rack2: 3, 4, 5
rack3: 6, 7, 8
</pre>
This API would return the list of 0, 3, 6, 1, 4, 7, 2, 5, 8
<br>
This is essential to make sure that the assignReplicasToBrokers API can use such list and
assign replicas to brokers in a simple round-robin fashion, while ensuring an even
distribution of leader and replica counts on each broker and that replicas are
distributed to all racks.
server-common/src/main/java/org/apache/kafka/admin/AdminUtils.java