Here you can find the source of gcdMultiple(int[] nums)
public static int gcdMultiple(int[] nums)
//package com.java2s; //License from project: Open Source License import java.util.Arrays; public class Main { public static int gcdMultiple(int[] nums) { if (nums.length == 0) return 0; Arrays.sort(nums);//w w w .j av a 2s. c o m int result = nums[0]; for (int i = 1; i < nums.length; ++i) { result = gcd(result, nums[i]); } return result; } public static int gcd(int a, int b) { while (b != 0) { int h = a % b; a = b; b = h; } return a; } }