Emanuel Kadziela's Shuffling Algorithm

Here is a repost of the problem:
"Given a deck of nCards unique cards, cut the deck iCut cards from top and perform a perfect shuffle. A perfect shuffle begins by putting down the bottom card from the top portion of the deck followed by the bottom card from the bottom portion of the deck followed by the next card from the top portion, etc., alternating cards until one portion is used up. The remaining cards go on top. The problem is to find the number of perfect shuffles required to return the deck to its original order. Your function should be declared as: static long shuffles(int nCards,int iCut); Please send the result of shuffles(1002,101) along with your program..."
Here is the java implementation of the algorithm Shuffles.java
The result of shuffles(1002,101) is 5,812,104,600
The algorithm exploits the fact that every card in the deck will reappear in its original position with some frequency (for instance the first card may reappear in the first position every 5 shuffles, the second one may reappear every 6 shuffles, the third one every 4 shuffles, etc.). The lowest number of shuffles required to bring ALL cards to their original positions is simply the lowest number that is integrally divisible by all frequencies. My implementation could certainly be improved, but it sufficient to showcase the general solution to the problem.