I have this homework question and I'm not 100% sure what it's asking. Could you break it down for me or write the skeleton code so I can get a better grasp of it?

Write an alternative gcd algorithm, based on the following observations (arrange A > B) .

a. gcd(A, B) = 2*gcd(A/2, B/2) if A and B are both even
b. gcd(A, B) = gcd(A/2, B) if A is even and B is odd
c. gcd(A, B) = gcd(A, B/2) if A is odd and B is even
d. gcd(A, B) = gcd( (A+B)/2, (A-B)/2) if A and B are both odd

public static long gcd ( long a , long b ) {
      if (a < b) return gcd ( b , a ) ;
     // a >= b 
     if (b == 0) return a ;
     …   // complete the code here using the logic given above in a, b, c and d

How would I write something like this? I don't even understand the piece of code that is given.