Here you can find the source of maxCommonDivisor(int m, int n)
public static int maxCommonDivisor(int m, int n)
//package com.java2s; //License from project: Open Source License public class Main { public static int maxCommonDivisor(int m, int n) { if (m < n) { // keep the order m > n int temp = m; m = n;//from w w w.java2 s .c o m n = temp; } if (m % n == 0) { // if m divide by n is 0, n is the max common divisor return n; } return maxCommonDivisor(n, m % n); // recurse n and the remainder of m divide n } }