In the diagram above, by considering the inverse we can see that if the hex addresses ends in a number that is the "opposite" of the direction we want to go, the new address just replaces the last digit with a 0
.
By opposite here, we mean:
1 <-> 4
2 <-> 5
3 <-> 6