style: include IM_AVERAGE_COMPUTATION_COULD_OVERFLOW
(#5131)
This commit is contained in:
parent
b075c19a54
commit
2513ccd62b
@ -8,9 +8,6 @@
|
||||
<Match>
|
||||
<Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD" />
|
||||
</Match>
|
||||
<Match>
|
||||
<Bug pattern="IM_AVERAGE_COMPUTATION_COULD_OVERFLOW" />
|
||||
</Match>
|
||||
<Match>
|
||||
<Bug pattern="DMI_RANDOM_USED_ONLY_ONCE" />
|
||||
</Match>
|
||||
|
@ -97,7 +97,7 @@ public class LongestIncreasingSubsequence {
|
||||
return end + 1;
|
||||
}
|
||||
while (left < right - 1) {
|
||||
int middle = (left + right) / 2;
|
||||
final int middle = (left + right) >>> 1;
|
||||
if (t[middle] < key) {
|
||||
left = middle;
|
||||
} else {
|
||||
|
@ -26,7 +26,7 @@ public class RangeInSortedArray {
|
||||
if (left > right) {
|
||||
return;
|
||||
}
|
||||
int mid = (left + right) / 2;
|
||||
int mid = (left + right) >>> 1;
|
||||
if (nums[mid] > key) {
|
||||
alteredBinSearch(nums, key, left, mid - 1, range, goLeft);
|
||||
} else if (nums[mid] < key) {
|
||||
@ -52,7 +52,7 @@ public class RangeInSortedArray {
|
||||
// of 'key'
|
||||
public static void alteredBinSearchIter(int[] nums, int key, int left, int right, int[] range, boolean goLeft) {
|
||||
while (left <= right) {
|
||||
int mid = (left + right) / 2;
|
||||
final int mid = (left + right) >>> 1;
|
||||
if (nums[mid] > key) {
|
||||
right = mid - 1;
|
||||
} else if (nums[mid] < key) {
|
||||
@ -84,7 +84,7 @@ public class RangeInSortedArray {
|
||||
public static int getLessThan(int[] nums, int key, int left, int right) {
|
||||
int count = 0;
|
||||
while (left <= right) {
|
||||
int mid = (left + right) / 2;
|
||||
final int mid = (left + right) >>> 1;
|
||||
if (nums[mid] > key) {
|
||||
right = mid - 1;
|
||||
} else if (nums[mid] <= key) {
|
||||
|
@ -10,7 +10,7 @@ public class BinaryInsertionSort {
|
||||
int high = i - 1;
|
||||
|
||||
while (low <= high) {
|
||||
int mid = (low + high) / 2;
|
||||
final int mid = (low + high) >>> 1;
|
||||
if (temp < array[mid]) {
|
||||
high = mid - 1;
|
||||
} else {
|
||||
|
@ -16,7 +16,7 @@ public class SlowSort implements SortAlgorithm {
|
||||
if (SortUtils.greaterOrEqual(i, j)) {
|
||||
return;
|
||||
}
|
||||
int m = (i + j) / 2;
|
||||
final int m = (i + j) >>> 1;
|
||||
sort(array, i, m);
|
||||
sort(array, m + 1, j);
|
||||
if (SortUtils.less(array[j], array[m])) {
|
||||
|
Loading…
Reference in New Issue
Block a user