public int getHandValue(Hand hand) {
        // return 0 if hand is null
        if (hand == null) {
            return 0;
        }
        // value of hand and number of aces
        int value = 0;
        int aces = 0;
        // go through all cards, add the values and count the aces
        for (Card c : hand) {
            String picture = c.getPicture();
            if (picture.equals("ace")) {
                ++aces;
            } else {
                value += getPictureValue(picture);
            }
        }
        // add the aces as 1 first
        value += aces;
        // loop to choose the value of the aces (1 or 11)
        for (int i = 0; i < aces; ++i) {
            if ((value + TEN) <= TWENTY_ONE) {
                value += TEN;
            } else {
                break;
            }
        }
        return value;
    }