Here you can find the source of gcd1(long given1, long given2)
public static long gcd1(long given1, long given2)
//package com.java2s; //License from project: Open Source License public class Main { public static long gcd1(long given1, long given2) { if (given1 == 0 || given2 == 0) return -1; long a = given1 % given2; long b = given2 % a; long t = 0; while (b != 0) { t = b;//from w w w.j a v a2 s .c o m b = a % b; a = t; } return a; } }