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));
}
}
|