style: resolve some FCBL_FIELD_COULD_BE_LOCAL warnings (#5764)

style: make simple fields local
This commit is contained in:
Piotr Idzik
2024-10-13 17:16:10 +02:00
committed by GitHub
parent 9b52ac9633
commit ebc3cd2233
5 changed files with 6 additions and 16 deletions

View File

@ -6,7 +6,6 @@ import java.util.Scanner;
class Cycle {
private final int nodes;
private final int edges;
private int[][] adjacencyMatrix;
private boolean[] visited;
ArrayList<ArrayList<Integer>> cycles = new ArrayList<ArrayList<Integer>>();
@ -16,7 +15,7 @@ class Cycle {
System.out.print("Enter the no. of nodes: ");
nodes = in.nextInt();
System.out.print("Enter the no. of Edges: ");
edges = in.nextInt();
final int edges = in.nextInt();
adjacencyMatrix = new int[nodes][nodes];
visited = new boolean[nodes];

View File

@ -25,8 +25,6 @@ public class CRCAlgorithm {
private ArrayList<Integer> message;
private ArrayList<Integer> dividedMessage;
private ArrayList<Integer> p;
private Random randomGenerator;
@ -44,7 +42,6 @@ public class CRCAlgorithm {
messageChanged = false;
message = new ArrayList<>();
messSize = size;
dividedMessage = new ArrayList<>();
p = new ArrayList<>();
for (int i = 0; i < str.length(); i++) {
p.add(Character.getNumericValue(str.charAt(i)));
@ -103,7 +100,6 @@ public class CRCAlgorithm {
public void refactor() {
messageChanged = false;
message = new ArrayList<>();
dividedMessage = new ArrayList<>();
}
/**
@ -156,7 +152,7 @@ public class CRCAlgorithm {
}
}
}
dividedMessage = (ArrayList<Integer>) x.clone();
ArrayList<Integer> dividedMessage = (ArrayList<Integer>) x.clone();
if (!check) {
message.addAll(dividedMessage);
} else {

View File

@ -259,14 +259,12 @@ class Task1 {
class Task2 {
private int[] a;
public Node sortByHeapSort(Node head) {
if (head == null || head.next == null) {
return head;
}
int c = count(head);
a = new int[c];
int[] a = new int[c];
// Array of size c is created
int i = 0;
for (Node ptr = head; ptr != null; ptr = ptr.next) {