/*求最大公约数 辗转相除法*/ public class Main { public static void main(String[] args) { System.out.println(gcd(14, 21)); } static int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } }