Java BigInteger Calculate gcd(Iterable nums)

Here you can find the source of gcd(Iterable nums)

Description

gcd

License

Apache License

Declaration

public static BigInteger gcd(Iterable<BigInteger> nums) 

Method Source Code

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

import java.math.BigInteger;

public class Main {
    public static BigInteger gcd(Iterable<BigInteger> nums) {
        BigInteger ret = null;/*from w w w.  j  ava  2  s  .c  om*/
        for (BigInteger num : nums) {
            if (ret == null) {
                ret = num;
            } else {
                ret = ret.gcd(num);
            }
        }
        return ret;
    }
}

Related

  1. first(BigInteger i, BigInteger j)
  2. firstLtSecond(BigInteger first, BigInteger second)
  3. gcd(BigInteger a, BigInteger b)
  4. GCD(BigInteger x, BigInteger y)
  5. gcd(BigInteger... values)
  6. gcdEuclides(BigInteger a, BigInteger b)
  7. gcdExtended(BigInteger p, BigInteger q)
  8. getAddressText(BigInteger address)
  9. getByteArrayFromBigIntegerArray(Object value)