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