Java Utililty Methods lcm

List of utility methods to do lcm

Description

The list of methods to do lcm are organized into topic(s).

Method

doubleLCM(double a, double b)
LCM
double largerValue = a;
double smallerValue = b;
if (b > a) {
    largerValue = b;
    smallerValue = a;
for (int i = 1; i <= largerValue; i++) {
    if ((largerValue * i) % smallerValue == 0) {
...
intlcm(int a, int b)

Returns the least common multiple of the absolute value of two numbers, using the formula lcm(a,b) = (a / gcd(a,b)) * b.

if (a == 0 || b == 0) {
    return 0;
int lcm = Math.abs(mulAndCheck(a / gcd(a, b), b));
return lcm;
intlcm(int a, int b)
lcm
int c = gcd(a, b);
if (c == 0) {
    return 0;
return a / c * b;
intlcm(int a, int b)
Least common multiple.
http://en.wikipedia.org/wiki/Least_common_multiple
lcm( 6, 9 ) = 18
lcm( 4, 9 ) = 36
lcm( 0, 9 ) = 0
lcm( 0, 0 ) = 0
if (a == 0 || b == 0)
    return 0;
return Math.abs(a / gcd(a, b) * b);
intlcm(int a, int b)
Returns the least common multiple of two integers.
int ret = a / gcd(a, b) * b; 
return (ret < 0 ? -ret : ret);
intlcm(int a, int b)
lcm
return a * (b / gcd(a, b));
intlcm(int a, int b)
lcm
return a * b / gcd(a, b);
intlcm(int a, int b)
lcm
int temp = gcd(a, b);
return temp > 0 ? (a / temp * b) : 0;
intlcm(int a, int b)
Returns the lowest common multiple between a and b.
return b * a / gcd(a, b);
intlcm(int a, int b)
Returns the least common multiple between two integer values.
return Math.abs(mulAndCheck(a / gcd(a, b), b));