HBaseUtils { public static String generateSplitKeys(int startKey, int endKey, int stepSize, int fill) { StringBuilder strBuilder = new StringBuilder("SPLITS => ["); for (int i = startKey; i <= endKey; i += stepSize) strBuilder.append("'").append(StrUtils.fillWithZero(i, fill)).append("', "); return strBuilder.append("]").toString().replaceAll(", ]", "]"); } private  HBaseUtils(); static HBaseUtils getInstance(); static void setUpEnv(); static boolean createTable(Admin admin, HTableDescriptor table, byte[][] splits); static String getNameSpace(RegionLoad region); static String getSingleTableName(RegionLoad region); static String getTableName(RegionLoad region); static String extractTableName(String regionName); static LinkedList<String> splitJmxRegion(String aim); static String removeEndKey(String regionName); static String extractTimestamp4Region(String regionName); static String extractHostName(String regionServerName); static String removeTimestamp(String regionServerName); static String extractTimestamp4RS(String regionServerName); static String generateSplitKeys(int startKey, int endKey, int stepSize, int fill); static byte[][] getHexSplits(String startKey, String endKey, int numRegions); Date getClusterStartTime(); String getClusterStartTimeStr();  }
@Test public void generateSplitKeysTest() { assertEquals("SPLITS => ['-128', '-112', '-96', '-80', '-64', '-48', '-32', '-16', '0', " + "'16', '32', '48', '64', '80', '96', '112', '128']", HBaseUtils.generateSplitKeys(-128, 128, 16, 0)); assertEquals("SPLITS => ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', " + "'14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', " + "'31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', " + "'48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', " + "'65', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80']", HBaseUtils.generateSplitKeys(0, 80, 1, 2)); assertEquals("SPLITS => ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']", HBaseUtils.generateSplitKeys(1, 10, 1, 0)); }