Class | Line # | Actions | ||||
---|---|---|---|---|---|---|
MathUtils | 3 | 3 | 2 | 0 |
1 | package jalview.util; | |
2 | ||
3 | public class MathUtils | |
4 | { | |
5 | ||
6 | /** | |
7 | * Returns the greatest common divisor of two integers | |
8 | * | |
9 | * @param a | |
10 | * @param b | |
11 | * @return | |
12 | */ | |
13 | 50 | public static int gcd(int a, int b) |
14 | { | |
15 | 50 | if (b == 0) |
16 | { | |
17 | 21 | return Math.abs(a); |
18 | } | |
19 | 29 | return gcd(b, a % b); |
20 | } | |
21 | ||
22 | } |