Skip to content

Commit 0f5d461

Browse files
Fix Checkstyle issues in FibonacciSeries.java
1 parent 01b69fb commit 0f5d461

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/main/java/com/thealgorithms/Recursion/FibonacciSeries.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@
88
*/
99

1010
public class FibonacciSeries {
11-
static int fib(int n) {
12-
if (n == 0 || n == 1)
11+
private FibonacciSeries() {
12+
throw new UnsupportedOperationException("Utility class");
13+
}
14+
public static int fibonacci(int n) {
15+
if (n <= 1) {
1316
return n;
14-
else
15-
return fib(n - 1) + fib(n - 2);
17+
} else {
18+
return fibonacci(n - 1) + fibonacci(n - 2);
19+
}
1620
}
1721
}

0 commit comments

Comments
 (0)