mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-06 00:54:32 +08:00
style: resolve some FCBL_FIELD_COULD_BE_LOCAL
warnings (#5764)
style: make simple fields local
This commit is contained in:
@ -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];
|
||||
|
@ -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 {
|
||||
|
@ -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) {
|
||||
|
Reference in New Issue
Block a user