public static List<RegionInfo> addReplicas(final List<RegionInfo> regions, int oldReplicaCount,
    int newReplicaCount) {
    if ((newReplicaCount - 1) <= 0) {
      return regions;
    }
    List<RegionInfo> hRegionInfos = new ArrayList<>(newReplicaCount * regions.size());
    for (RegionInfo ri : regions) {
      if (
        RegionReplicaUtil.isDefaultReplica(ri)
          && (!ri.isOffline() || (!ri.isSplit() && !ri.isSplitParent()))
      ) {
        // region level replica index starts from 0. So if oldReplicaCount was 2 then the max
        // replicaId for
        // the existing regions would be 1
        for (int j = oldReplicaCount; j < newReplicaCount; j++) {
          hRegionInfos.add(RegionReplicaUtil.getRegionInfoForReplica(ri, j));
        }
      }
    }
    hRegionInfos.addAll(regions);
    return hRegionInfos;
  }
Create any replicas for the regions (the default replicas that was already created is passed to
the method)
@param regions         existing regions
@param oldReplicaCount existing replica count
@param newReplicaCount updated replica count due to modify table
@return the combined list of default and non-default replicas
hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionReplicaUtil.java