You will probably have to make algorithms that can check for the existance of each type of hand and the strength of the hand.
To compare the hands, the algorithms could assign each hand a two-part score. The first part of the score would be the rank of the hand as you have shown above (high card = 1, 1 pair = 2, etc..). The second score would be the strength of the hand compared to other hands of the same type (pair of 2s = 1, pair of 3s = 2, etc). Then you just have to sort the first set of scores (and the second set if there are more than one of a particular type of hand).
-genius_at_work