private static int getMaxReplicaId(List<RegionInfo> regions) {
    int max = 0;
    for (RegionInfo regionInfo : regions) {
      if (regionInfo.getReplicaId() > max) {
        // Iterating through all the list to identify the highest replicaID region.
        // We can stop after checking with the first set of regions??
        max = regionInfo.getReplicaId();
      }
    }
    return max;

  }
Returns Maximum region replica id found in passed list of regions.
hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/EnableTableProcedure.java