Here you can find the source of LCM1(int A, int B)
public static long LCM1(int A, int B)
//package com.java2s; //License from project: Open Source License public class Main { public static long LCM1(int A, int B) { long lowestCommonMultiple = A * B; int curNum = 0; int indexA = 1; int indexB = 1; int curA = 1; int curB = 1; while (curNum < (A * B)) { curA = A * indexA;/* www . ja v a2 s .co m*/ curB = B * indexB; if (curA < curB) { curNum = curA; indexA++; } else { curNum = curB; indexB++; } if ((curNum % A == 0) && (curNum % B == 0)) { if (curNum < lowestCommonMultiple) { lowestCommonMultiple = curNum; break; } } } return lowestCommonMultiple; } }