How to find LCM to two numbers in Java?

Use the following code to find LCM (Lease common multiple) of two numbers in Java.

public static void getLCM(int a , int b)
{
    int min = Math.min(a, b);
    int max = Math.max(a, b);
    int i = 1;
    while(i<=min)
    {
         if((max*i)%min==0)
         {
                System.out.println("lcm -- "+max*i);
                break;
         }
         i++;
       }
       
}

Search