Here you can find the source of maxCommonDivisor(int num1, int num2)
public static int maxCommonDivisor(int num1, int num2)
//package com.java2s; //License from project: Open Source License public class Main { public static int maxCommonDivisor(int num1, int num2) { return num1 >= num2 ? maxCommonDivisorCore(num1, num2) : maxCommonDivisorCore(num2, num1); }/*from w w w . j a v a 2 s . c o m*/ private static int maxCommonDivisorCore(int num1, int num2) { if (num1 % num2 == 0) { return num2; } return maxCommonDivisorCore(num2, num1 % num2); } }