BAEL-5004 Fixed overflow issues for Large numbers (#10899)

Co-authored-by: Remy Ohajinwa <remy.ohajinwa@interswitchgroup.com>
This commit is contained in:
Remy Ohajinwa 2021-06-17 03:10:33 +01:00 committed by GitHub
parent 19129f3721
commit 940773966e
1 changed files with 2 additions and 2 deletions

View File

@ -12,7 +12,7 @@ public class BinarySearch {
while (low <= high) {
int mid = (low + high) / 2;
int mid = low + ((high - low) / 2);
if (sortedArray[mid] < key) {
low = mid + 1;
@ -28,7 +28,7 @@ public class BinarySearch {
public int runBinarySearchRecursively(int[] sortedArray, int key, int low, int high) {
int middle = (low + high) / 2;
int middle = low + ((high - low) / 2);
if (high < low) {
return -1;
}