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

committed by
GitHub

parent
8be8b953ab
commit
160742104d
@ -109,7 +109,7 @@
|
|||||||
<!-- Checks for Naming Conventions. -->
|
<!-- Checks for Naming Conventions. -->
|
||||||
<!-- See https://checkstyle.org/checks/naming/index.html -->
|
<!-- See https://checkstyle.org/checks/naming/index.html -->
|
||||||
<module name="ConstantName"/>
|
<module name="ConstantName"/>
|
||||||
<!-- TODO <module name="LocalFinalVariableName"/> -->
|
<module name="LocalFinalVariableName"/>
|
||||||
<!-- TODO <module name="LocalVariableName"/> -->
|
<!-- TODO <module name="LocalVariableName"/> -->
|
||||||
<!-- TODO <module name="MemberName"/> -->
|
<!-- TODO <module name="MemberName"/> -->
|
||||||
<!-- TODO <module name="MethodName"/> -->
|
<!-- TODO <module name="MethodName"/> -->
|
||||||
|
@ -16,13 +16,13 @@ public final class DudeneyNumber {
|
|||||||
throw new IllegalArgumentException("Input must me positive.");
|
throw new IllegalArgumentException("Input must me positive.");
|
||||||
}
|
}
|
||||||
// Calculating Cube Root
|
// 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 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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the cube root of the number is not equal to the sum of its digits, we 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
|
@Override
|
||||||
public <T extends Comparable<T>> T[] sort(T[] array) {
|
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 i = 0; i < length; i++) {
|
||||||
for (int j = i + 1; j < LENGTH; j++) {
|
for (int j = i + 1; j < length; j++) {
|
||||||
if (SortUtils.less(array[j], array[i])) {
|
if (SortUtils.less(array[j], array[i])) {
|
||||||
T element = array[j];
|
T element = array[j];
|
||||||
array[j] = array[i];
|
array[j] = array[i];
|
||||||
|
Reference in New Issue
Block a user