DecimalStringSplit implements org.apache.hadoop.hbase.util.RegionSplitter.SplitAlgorithm { @VisibleForTesting static int digits(int number) { return number == 0 ? 1 : (int) (Math.log10(Math.abs(number)) + 1); } DecimalStringSplit(int cardinality); @Override byte[] split(byte[] start, byte[] end); @Override byte[][] split(int numRegions); @Override byte[] firstRow(); @Override byte[] lastRow(); @Override void setFirstRow(String userInput); @Override void setLastRow(String userInput); @Override byte[] strToRow(String input); @Override String rowToStr(byte[] row); @Override String separator(); void setFirstRow(byte[] userInput); void setLastRow(byte[] userInput);  }
@Test public void testDigits() throws Exception { assertEquals(1, DecimalStringSplit.digits(0)); assertEquals(1, DecimalStringSplit.digits(1)); assertEquals(1, DecimalStringSplit.digits(9)); assertEquals(2, DecimalStringSplit.digits(10)); assertEquals(2, DecimalStringSplit.digits(99)); assertEquals(3, DecimalStringSplit.digits(100)); assertEquals(6, DecimalStringSplit.digits(100000)); assertEquals(1, DecimalStringSplit.digits(-1)); }