public class Deck {
  public Card[] cards = new Card[52];
  // initialization block
  {
    int i = 0;
    for (byte suit = Card.CLUBSUIT; suit <= Card.SPADESUIT; suit++) {
      for (byte rank = 2; rank <= 14; rank++) {
        cards[i] = new Card();
        cards[i].suit = suit;
        cards[i].rank = rank;
        i++;
      }
    }
  }

  public void shuffle() {
    for (int i=0; i<52; i++) {
      int from=(int) (Math.random() * 52);
      int to=(int) (Math.random() *52);

      Card temp=cards[from];
      cards[from]=cards[to];
      cards[to]=temp;
    }
  }

  public Card[] deal() {
    Card[] result=new Card[4];
    result[0]=cards[0];
    result[1]=cards[1];
    result[2]=cards[2];
    result[3]=cards[3];

    System.out.println(result[0]);
    System.out.println(result[1]);
    System.out.println(result[2]);
    System.out.println(result[3]);

    return result;
  }
}
