mirror of
https://github.com/TheAlgorithms/Java.git
synced 2026-03-13 08:40:43 +08:00
style: enable NeedBraces in checkstyle (#5227)
* enable style NeedBraces * style: enable NeedBraces in checkstyle --------- Co-authored-by: Samuel Facchinello <samuel.facchinello@piksel.com>
This commit is contained in:
committed by
GitHub
parent
51fcc66345
commit
87b17e0571
@@ -34,7 +34,9 @@ public final class AliquotSum {
|
||||
* @return aliquot sum of given {@code number}
|
||||
*/
|
||||
public static int getAliquotSum(int n) {
|
||||
if (n <= 0) return -1;
|
||||
if (n <= 0) {
|
||||
return -1;
|
||||
}
|
||||
int sum = 1;
|
||||
double root = Math.sqrt(n);
|
||||
/*
|
||||
@@ -53,7 +55,9 @@ public final class AliquotSum {
|
||||
}
|
||||
// if n is a perfect square then its root was added twice in above loop, so subtracting root
|
||||
// from sum
|
||||
if (root == (int) root) sum -= root;
|
||||
if (root == (int) root) {
|
||||
sum -= root;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user