Here you can find the source of gcd(long a, long b)
Parameter | Description |
---|---|
a | One of the values |
b | The other value |
public static long gcd(long a, long b)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w w w. j av a2s . co m*/ * Greatest common divisor using Euclides algorithm. * * @param a One of the values * @param b The other value * @return The greatest common divisor */ public static long gcd(long a, long b) { while (b != 0) { long n = a % b; a = b; b = n; } return a; } }