Enabled LocalFinalVariableName in Checkstyle (#5172)

This commit is contained in:
Godwill Christopher
2024-05-24 05:08:37 -06:00
committed by GitHub
parent 8be8b953ab
commit 160742104d
3 changed files with 7 additions and 7 deletions

View File

@ -16,13 +16,13 @@ public final class DudeneyNumber {
throw new IllegalArgumentException("Input must me positive.");
}
// Calculating Cube Root
final int cube_root = (int) Math.round(Math.pow(n, 1.0 / 3.0));
final int cubeRoot = (int) Math.round(Math.pow(n, 1.0 / 3.0));
// If the number is not a perfect cube the method returns false.
if (cube_root * cube_root * cube_root != n) {
if (cubeRoot * cubeRoot * cubeRoot != n) {
return false;
}
// If the cube root of the number is not equal to the sum of its digits, we return false.
return cube_root == SumOfDigits.sumOfDigits(n);
return cubeRoot == SumOfDigits.sumOfDigits(n);
}
}

View File

@ -4,10 +4,10 @@ public class SimpleSort implements SortAlgorithm {
@Override
public <T extends Comparable<T>> T[] sort(T[] array) {
final int LENGTH = array.length;
final int length = array.length;
for (int i = 0; i < LENGTH; i++) {
for (int j = i + 1; j < LENGTH; j++) {
for (int i = 0; i < length; i++) {
for (int j = i + 1; j < length; j++) {
if (SortUtils.less(array[j], array[i])) {
T element = array[j];
array[j] = array[i];