Here you can find the source of GCD(int m, int n)
static private int GCD(int m, int n)
//package com.java2s; public class Main { /**//w ww . ja va 2 s . c o m * @return gcd(|m|, |n|) */ static private int GCD(int m, int n) { if (m < 0) { m = -m; } if (n < 0) { n = -n; } if (0 == n) { return m; } else { return GCD(n, m % n); } } }