Here you can find the source of gcd(long x, long y)
Parameter | Description |
---|---|
x | First number |
y | Second number |
public static long gcd(long x, long y)
//package com.java2s; //License from project: Open Source License public class Main { /**// w w w .j a v a 2 s . c o m * Implemented recursively with Euclidian Algorithm * * @param x * First number * @param y * Second number * @return GCD of x and y */ public static long gcd(long x, long y) { return (y == 0) ? x : gcd(y, x % y); } }