Java gcd gcd(int a, int b, int... rest)

Here you can find the source of gcd(int a, int b, int... rest)

Description

gcd

License

Apache License

Declaration

public static int gcd(int a, int b, int... rest) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static int gcd(int a, int b, int... rest) {
        if (rest.length > 0) {
            int[] rest1 = new int[rest.length - 1];
            System.arraycopy(rest, 1, rest1, 0, rest1.length);
            return gcd(gcd(a, b), rest[0], rest1);
        }/*www.  j a  v  a2s  .  c  o m*/
        return b == 0 ? a : gcd(b, a % b);
    }
}

Related

  1. gcd(int a, int b)
  2. gcd(int a, int b)
  3. gcd(int a, int b)
  4. gcd(int a, int b)
  5. gcd(int a, int b)
  6. gcd(int firstNumber, int secondNumber)
  7. gcd(int k, int m)
  8. gcd(int largerNumber, int smallerNumber)
  9. gcd(int m, int n)