I don't understand about this program is doing. Could someone please tell me what it is about. Because I have gcd function in one program that calls this function. Thanks a lot
Code:
switch (opcode) {
case GCD: out = b1.gcd(b2).toString();
break;
Code:
/**
* Returns a BigInteger whose value is the greatest common divisor of
* <tt>abs(this)</tt> and <tt>abs(val)</tt>. Returns 0 if
* <tt>this==0 && val==0</tt>.
*
* @param val value with with the GCD is to be computed.
* @return <tt>GCD(abs(this), abs(val))</tt>
*/
public BigInteger gcd(BigInteger val) {
if (val.signum == 0)
return this.abs();
else if (this.signum == 0)
return val.abs();
MutableBigInteger a = new MutableBigInteger(this);
MutableBigInteger b = new MutableBigInteger(val);
MutableBigInteger result = a.hybridGCD(b);
return new BigInteger(result, 1);
}
Comment