@Test public void testLong_01() { long count = 8; long left = 0; long right = count - 1; int expectSliceNumber = 3; long[] result = RangeSplitUtil.doLongSplit(left, right, expectSliceNumber); result[result.length - 1]++; for (int i = 0; i < result.length - 1; i++) { System.out.println("start:" + result[i] + " count:" + (result[i + 1] - result[i])); } Assert.assertTrue(result.length - 1 == expectSliceNumber); System.out.println(Arrays.toString(result)); }
public static long[] doLongSplit(long left, long right, int expectSliceNumber) { BigInteger[] result = doBigIntegerSplit(BigInteger.valueOf(left), BigInteger.valueOf(right), expectSliceNumber); long[] returnResult = new long[result.length]; for (int i = 0, len = result.length; i < len; i++) { returnResult[i] = result[i].longValue(); } return returnResult; }
RangeSplitUtil { public static long[] doLongSplit(long left, long right, int expectSliceNumber) { BigInteger[] result = doBigIntegerSplit(BigInteger.valueOf(left), BigInteger.valueOf(right), expectSliceNumber); long[] returnResult = new long[result.length]; for (int i = 0, len = result.length; i < len; i++) { returnResult[i] = result[i].longValue(); } return returnResult; } }
RangeSplitUtil { public static long[] doLongSplit(long left, long right, int expectSliceNumber) { BigInteger[] result = doBigIntegerSplit(BigInteger.valueOf(left), BigInteger.valueOf(right), expectSliceNumber); long[] returnResult = new long[result.length]; for (int i = 0, len = result.length; i < len; i++) { returnResult[i] = result[i].longValue(); } return returnResult; }  }
RangeSplitUtil { public static long[] doLongSplit(long left, long right, int expectSliceNumber) { BigInteger[] result = doBigIntegerSplit(BigInteger.valueOf(left), BigInteger.valueOf(right), expectSliceNumber); long[] returnResult = new long[result.length]; for (int i = 0, len = result.length; i < len; i++) { returnResult[i] = result[i].longValue(); } return returnResult; }  static String[] doAsciiStringSplit(String left, String right, int expectSliceNumber); static long[] doLongSplit(long left, long right, int expectSliceNumber); static BigInteger[] doBigIntegerSplit(BigInteger left, BigInteger right, int expectSliceNumber); static BigInteger stringToBigInteger(String aString, int radix); static Pair<Character, Character> getMinAndMaxCharacter(String aString); }
RangeSplitUtil { public static long[] doLongSplit(long left, long right, int expectSliceNumber) { BigInteger[] result = doBigIntegerSplit(BigInteger.valueOf(left), BigInteger.valueOf(right), expectSliceNumber); long[] returnResult = new long[result.length]; for (int i = 0, len = result.length; i < len; i++) { returnResult[i] = result[i].longValue(); } return returnResult; }  static String[] doAsciiStringSplit(String left, String right, int expectSliceNumber); static long[] doLongSplit(long left, long right, int expectSliceNumber); static BigInteger[] doBigIntegerSplit(BigInteger left, BigInteger right, int expectSliceNumber); static BigInteger stringToBigInteger(String aString, int radix); static Pair<Character, Character> getMinAndMaxCharacter(String aString);  }