Java examples for java.lang:Math Number
Gets the greatest number divisible by both parameters
//package com.java2s; public class Main { /**/*from w w w . j av a2s . co m*/ * Gets the greatest number divisible by both parameters * * @param a Number 1 * @param b Number 2 * @return The GCD of the two parameters */ public static long gcd(long a, long b) { while (b != 0) { long tmp = b; b = a % b; a = tmp; } return a; } }