public void setupTable(TableName table, int cfs) throws IOException {
    try {
      LOG.info("Creating table " + table);
      TableDescriptorBuilder tableDescriptorBuilder = TableDescriptorBuilder.newBuilder(table);

      tableDescriptorBuilder.setCoprocessor(MyObserver.class.getName());
      MyObserver.sleepDuration = this.sleepDuration;
      for (int i = 0; i < 10; i++) {
        ColumnFamilyDescriptor columnFamilyDescriptor =
          ColumnFamilyDescriptorBuilder.newBuilder(Bytes.toBytes(family(i))).build();
        tableDescriptorBuilder.setColumnFamily(columnFamilyDescriptor);
      }

      UTIL.getAdmin().createTable(tableDescriptorBuilder.build());
    } catch (TableExistsException tee) {
      LOG.info("Table " + table + " already exists");
    }
  }
Creates a table with given table name and specified number of column families if the table does
not already exist.
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionServerBulkLoad.java