Java code for solving Deck of Cards problem.