Most efficient way to evaluate cards for TexasHoldEm game? <p>So I am in the process of making a texas holdem game. I am stuck on how to evualte the hands to see what type of scoring each player has (Two Pair, Flush etc) </p> <p>EDIT: I only need to deal 5 cards to each player and compare those 5 cards. Its not a complete texas holdem game.</p> <p>Any tips on how to do that? (I know this code is really sloppy, sorry!)</p> <pre><code>public class Main { public static void main(String[] args) { //CDHS run(); } public static void run() { List&lt;Card&gt; deck = new ArrayList(); Card C1 = new Card("1C"); Card C2 = new Card("2C"); Card C3 = new Card("3C"); Card C4 = new Card("4C"); Card C5 = new Card("5C"); Card C6 = new Card("6C"); Card C7 = new Card("7C"); Card C8 = new Card("8C"); Card C9 = new Card("9C"); Card CT = new Card("TC"); Card CJ = new Card("JC"); Card CQ = new Card("QC"); Card CK = new Card("KC"); Card CA = new Card("AC"); Card D1 = new Card("1D"); Card D2 = new Card("2D"); Card D3 = new Card("3D"); Card D4 = new Card("4D"); Card D5 = new Card("5D"); Card D6 = new Card("6D"); Card D7 = new Card("7D"); Card D8 = new Card("8D"); Card D9 = new Card("9D"); Card DT = new Card("TD"); Card DJ = new Card("JD"); Card DQ = new Card("QD"); Card DK = new Card("KD"); Card DA = new Card("AD"); Card H1 = new Card("1H"); Card H2 = new Card("2H"); Card H3 = new Card("3H"); Card H4 = new Card("4H"); Card H5 = new Card("5H"); Card H6 = new Card("6H"); Card H7 = new Card("7H"); Card H8 = new Card("8H"); Card H9 = new Card("9H"); Card HT = new Card("TH"); Card HJ = new Card("JH"); Card HQ = new Card("QH"); Card HK = new Card("KH"); Card HA = new Card("AH"); Card S1 = new Card("1S"); Card S2 = new Card("2S"); Card S3 = new Card("3S"); Card S4 = new Card("4S"); Card S5 = new Card("5S"); Card S6 = new Card("6S"); Card S7 = new Card("7S"); Card S8 = new Card("8S"); Card S9 = new Card("9S"); Card ST = new Card("TS"); Card SJ = new Card("JS"); Card SQ = new Card("QS"); Card SK = new Card("KS"); Card SA = new Card("AS"); deck.add(C1); deck.add(C2); deck.add(C3); deck.add(C4); deck.add(C5); deck.add(C6); deck.add(C7); deck.add(C8); deck.add(C9); deck.add(CT); deck.add(CJ); deck.add(CQ); deck.add(CK); deck.add(CA); deck.add(D1); deck.add(D2); deck.add(D3); deck.add(D4); deck.add(D5); deck.add(D6); deck.add(D6); deck.add(D7); deck.add(D8); deck.add(D9); deck.add(DT); deck.add(DJ); deck.add(DQ); deck.add(DK); deck.add(DA); deck.add(H1); deck.add(H2); deck.add(H3); deck.add(H4); deck.add(H5); deck.add(H6); deck.add(H7); deck.add(H8); deck.add(H9); deck.add(HT); deck.add(HJ); deck.add(HQ); deck.add(HK); deck.add(HA); deck.add(S1); deck.add(S2); deck.add(S3); deck.add(S4); deck.add(S5); deck.add(S6); deck.add(S7); deck.add(S8); deck.add(S9); deck.add(ST); deck.add(SJ); deck.add(SQ); deck.add(SK); deck.add(SA); } Collections.shuffle(deck); Player black = new Player(); Player white = new Player(); Card temp1 = deck.get(0); String temp2 = temp1.getValue(); black.setCard1(temp2); temp1 = deck.get(1); temp2 = temp1.getValue(); white.setCard1(temp2); temp1 = deck.get(2); temp2 = temp1.getValue(); black.setCard2(temp2); temp1 = deck.get(3); temp2 = temp1.getValue(); white.setCard2(temp2); temp1 = deck.get(4); temp2 = temp1.getValue(); black.setCard3(temp2); temp1 = deck.get(5); temp2 = temp1.getValue(); white.setCard3(temp2); temp1 = deck.get(6); temp2 = temp1.getValue(); black.setCard4(temp2); temp1 = deck.get(7); temp2 = temp1.getValue(); white.setCard4(temp2); temp1 = deck.get(8); temp2 = temp1.getValue(); black.setCard5(temp2); temp1 = deck.get(9); temp2 = temp1.getValue(); white.setCard5(temp2); System.out.println("Black: " + black.getCard1() + " " + black.getCard2() + " " + black.getCard3() + " " + black.getCard4() + " " + black.getCard5() + " White: " + white.getCard1() + " " + white.getCard2() + " " + white.getCard3() + " " + white.getCard4() + " " + white.getCard5()); int score; switch(black.getCard1() + black.getCard2() + black.getCard3() + black.getCard4() + black.getCard5()) { } } } </code></pre> <p>And heres the card class</p> <pre><code>public class Card { private String value; public Card(String value) { this.value = value; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } } </code></pre> <p>And Player class</p> <pre><code>public class Player { private String name; private String card1; private String card2; private String card3; private String card4; private String card5; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCard1() { return card1; } public String getCard2() { return card2; } public String getCard3() { return card3; } public String getCard4() { return card4; } public String getCard5() { return card5; } public void setCard1(String card1) { this.card1 = card1; } public void setCard2(String card2) { this.card2 = card2; } public void setCard3(String card3) { this.card3 = card3; } public void setCard4(String card4) { this.card4 = card4; } public void setCard5(String card5) { this.card5 = card5; } } </code></pre>