In this video, we create a private helper function (GCD) and a parameterless mutator (reduce) to complete the work on our Fraction class.
=-=
Blackbox code - GCD Method
private int gcd(int a, int b)
{
int big = Math.max(a, b);
int small = Math.min(a,b);
while ( big % small != 0)
{
//Chinese Remainder Theorem
int diff = big - small;
big = Math.max(diff, small);
small = Math.min(diff, small);
}
return small;
}