blob: 27fd4b27d189c9fad67f30456343f3203c36a60c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
package com.googlecode.mp4parser.util;
public class Math {
public static long gcd(long a, long b) {
while (b > 0) {
long temp = b;
b = a % b; // % is remainder
a = temp;
}
return a;
}
public static int gcd(int a, int b) {
while (b > 0) {
int temp = b;
b = a % b; // % is remainder
a = temp;
}
return a;
}
public static long lcm(long a, long b) {
return a * (b / gcd(a, b));
}
public static int lcm(int a, int b) {
return a * (b / gcd(a, b));
}
}
|