public static boolean validateIsr(int[] replicas, int[] isr) {
        if (isr.length == 0) return true;
        if (replicas.length == 0) return false;
        int[] sortedReplicas = clone(replicas);
        Arrays.sort(sortedReplicas);
        int[] sortedIsr = clone(isr);
        Arrays.sort(sortedIsr);
        int j = 0;
        if (sortedIsr[0] < 0) return false;
        int prevIsr = -1;
        for (int curIsr : sortedIsr) {
            if (prevIsr == curIsr) return false;
            prevIsr = curIsr;
            while (true) {
                if (j == sortedReplicas.length) return false;
                int curReplica = sortedReplicas[j++];
                if (curReplica == curIsr) break;
            }
        }
        return true;
    }
Check that an isr set is valid.

@param replicas      The replica set.
@param isr           The in-sync replica set.
@return              True if none of the in-sync replicas are negative, there are
                     no duplicates, and all in-sync replicas are also replicas.
metadata/src/main/java/org/apache/kafka/metadata/Replicas.java