public static RegionInfo[] createRegionInfos(TableDescriptor tableDescriptor,
    byte[][] splitKeys) {
    long regionId = EnvironmentEdgeManager.currentTime();
    RegionInfo[] hRegionInfos = null;
    if (splitKeys == null || splitKeys.length == 0) {
      hRegionInfos = new RegionInfo[] { RegionInfoBuilder.newBuilder(tableDescriptor.getTableName())
        .setStartKey(null).setEndKey(null).setSplit(false).setRegionId(regionId).build() };
    } else {
      int numRegions = splitKeys.length + 1;
      hRegionInfos = new RegionInfo[numRegions];
      byte[] startKey = null;
      byte[] endKey = null;
      for (int i = 0; i < numRegions; i++) {
        endKey = (i == splitKeys.length) ? null : splitKeys[i];
        hRegionInfos[i] = RegionInfoBuilder.newBuilder(tableDescriptor.getTableName())
          .setStartKey(startKey).setEndKey(endKey).setSplit(false).setRegionId(regionId).build();
        startKey = endKey;
      }
    }
    return hRegionInfos;
  }
Utility methods for interacting with the regions.
hbase-server/src/main/java/org/apache/hadoop/hbase/util/ModifyRegionUtils.java