Java examples for java.lang:Math Algorithm
greatest Common Divisor
//package com.java2s; public class Main { public static int greatestCommonDivisor(int a, int b) { while (b != 0) { int temp = b; b = a % b;/*w w w . ja va 2 s .c o m*/ a = temp; } return a; } }