/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.rwl.euclidian.algorithm;

/**
 *
 * @author RainWhileLoop
 */
public class Euclidian {

    public static int findGCD(int n1, int n2) {
        if (n1 == 0 || n2 == 0) {
            throw new ArithmeticException("Number must not zero!!!");
        }
        int max = Math.max(n1, n2);
        int min = Math.min(n1, n2);

        int fraction = max % min;
        showProcess(max,min);
        if (fraction != 0) {
            return findGCD(min, fraction);
        }

        return min;
    }

    private static void showProcess(int max, int min) {
        System.out.println(max + " = " + min + "(" + max / min + ") + " + max % min);
    }
}

@@ -278,16 +278,211 @@
 dian %7B%0A%0A
+    /**%0A     * Calculated the GCD of 2 numbers by using Euclidian Algorithm%0A     * @param num1 must not be 0%0A     * @param num2 must not be 0%0A     * @return GCD - greatest common divisor%0A     */%0A
     publ
@@ -512,16 +512,18 @@
 nt n
+um
 1, int n
 2) %7B
@@ -518,16 +518,18 @@
 1, int n
+um
 2) %7B%0A   
@@ -538,16 +538,18 @@
    if (n
+um
 1 == 0 %7C
@@ -551,16 +551,18 @@
 = 0 %7C%7C n
+um
 2 == 0) 
@@ -655,19 +655,24 @@
     int 
-max
+dividend
  = Math.
@@ -676,20 +676,24 @@
 th.max(n
+um
 1, n
+um
 2);%0A    
@@ -700,19 +700,23 @@
     int 
-min
+divisor
  = Math.
@@ -720,20 +720,24 @@
 th.min(n
+um
 1, n
+um
 2);%0A%0A   
@@ -760,48 +760,36 @@
 n = 
-max %25 min;%0A        showProcess(max,min);
+dividend %25 divisor;%0A        
 %0A   
@@ -841,19 +841,23 @@
 findGCD(
-min
+divisor
 , fracti
@@ -867,25 +867,24 @@
 ;%0A        %7D%0A
-%0A
         retu
@@ -890,166 +890,21 @@
 urn 
-min;%0A    %7D%0A%0A    private static void showProcess(int max, int min) %7B%0A        System.out.println(max + %22 = %22 + min + %22(%22 + max / min + %22) + %22 + max %25 min)
+divisor
 ;%0A    %7D%0A
 %7D%0A
@@ -901,10 +901,11 @@
 ;%0A    %7D%0A
+%0A
 %7D%0A

edit variable name , add document