我在数组上使用了binarySearchBigInteger
,我用几个数字进行了测试,似乎工作正常。所以我假设我不需要实现/覆盖任何方法(例如比较器)就可以正常工作?
我正在使用以下方法:
static int binarySearch(Object[] a, Object key)
//Searches the specified array for the specified object using the binary search algorithm.
像这样:
int i = Arrays.binarySearch(arrayOfBigIntsPreDefined,new BigInteger("1111111111111111"));
如果有更好/合适/众所周知的方法,也请提出建议。