mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-08 18:32:56 +08:00
style: include MAC_MANUAL_ARRAY_COPY
(#5199)
This commit is contained in:
@ -138,9 +138,6 @@
|
|||||||
<Match>
|
<Match>
|
||||||
<Bug pattern="USBR_UNNECESSARY_STORE_BEFORE_RETURN" />
|
<Bug pattern="USBR_UNNECESSARY_STORE_BEFORE_RETURN" />
|
||||||
</Match>
|
</Match>
|
||||||
<Match>
|
|
||||||
<Bug pattern="MAC_MANUAL_ARRAY_COPY" />
|
|
||||||
</Match>
|
|
||||||
<Match>
|
<Match>
|
||||||
<Bug pattern="SPP_USE_ISEMPTY" />
|
<Bug pattern="SPP_USE_ISEMPTY" />
|
||||||
</Match>
|
</Match>
|
||||||
|
@ -34,9 +34,7 @@ public final class BFPRT {
|
|||||||
|
|
||||||
public static int[] copyArray(int[] arr) {
|
public static int[] copyArray(int[] arr) {
|
||||||
int[] copyArr = new int[arr.length];
|
int[] copyArr = new int[arr.length];
|
||||||
for (int i = 0; i < arr.length; i++) {
|
System.arraycopy(arr, 0, copyArr, 0, arr.length);
|
||||||
copyArr[i] = arr[i];
|
|
||||||
}
|
|
||||||
return copyArr;
|
return copyArr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,10 +60,7 @@ public final class BankersAlgorithm {
|
|||||||
int[] safeSequenceArray = new int[totalProcess];
|
int[] safeSequenceArray = new int[totalProcess];
|
||||||
|
|
||||||
int[] workArray = new int[totalResources];
|
int[] workArray = new int[totalResources];
|
||||||
|
System.arraycopy(availableArray, 0, workArray, 0, totalResources);
|
||||||
for (int i = 0; i < totalResources; i++) {
|
|
||||||
workArray[i] = availableArray[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
@ -34,10 +34,8 @@ public final class ReturnSubsequence {
|
|||||||
// position=1
|
// position=1
|
||||||
|
|
||||||
String[] ans = new String[2 * smallAns.length]; // Our answer will be an array off string of size=2*smallAns
|
String[] ans = new String[2 * smallAns.length]; // Our answer will be an array off string of size=2*smallAns
|
||||||
int i = 0;
|
System.arraycopy(smallAns, 0, ans, 0, smallAns.length);
|
||||||
for (; i < smallAns.length; i++) {
|
|
||||||
ans[i] = smallAns[i]; // Copying all the strings present in smallAns to ans string array
|
|
||||||
}
|
|
||||||
for (int k = 0; k < smallAns.length; k++) {
|
for (int k = 0; k < smallAns.length; k++) {
|
||||||
ans[k + smallAns.length] = givenString.charAt(0) + smallAns[k]; // Insert character at index=0 of the given
|
ans[k + smallAns.length] = givenString.charAt(0) + smallAns[k]; // Insert character at index=0 of the given
|
||||||
// substring in front of every string
|
// substring in front of every string
|
||||||
|
@ -35,9 +35,7 @@ final class RadixSort {
|
|||||||
count[(arr[i] / exp) % 10]--;
|
count[(arr[i] / exp) % 10]--;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
System.arraycopy(output, 0, arr, 0, n);
|
||||||
arr[i] = output[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void radixsort(int[] arr, int n) {
|
private static void radixsort(int[] arr, int n) {
|
||||||
|
Reference in New Issue
Block a user