Here you can find the source of lcm(int a, int b)
public static int lcm(int a, int b)
//package com.java2s; //License from project: Open Source License public class Main { public static int lcm(int a, int b) { int temp = gcd(a, b); return temp > 0 ? (a / temp * b) : 0; }//from w ww . j a v a 2 s .c om public static int gcd(int a, int b) { for (;;) { if (a == 0) return b; b %= a; if (b == 0) return a; a %= b; } } }