Here you can find the source of gcd(Iterable
public static BigInteger gcd(Iterable<BigInteger> nums)
//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; } }