mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-10 13:39:08 +08:00
Enabled LocalFinalVariableName in Checkstyle (#5172)
This commit is contained in:

committed by
GitHub

parent
8be8b953ab
commit
160742104d
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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];
|
||||
|
Reference in New Issue
Block a user