private static void rearrangeTopOfLibrary(final Card src, final Player player, final int numCards, boolean mayshuffle) {
        PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
        int maxCards = lib.size();
        maxCards = Math.min(maxCards, numCards);
        if (maxCards == 0) return;
        CardList topCards = new CardList();
        //show top n cards:
        for (int j = 0; j < maxCards; j++) {
            topCards.add(lib.get(j));
        }
        for (int i = 1; i <= maxCards; i++) {
            String suffix = "";
            switch (i) {
                case 1:
                    suffix = "st";
                    break;
                case 2:
                    suffix = "nd";
                    break;
                case 3:
                    suffix = "rd";
                    break;
                default:
                    suffix = "th";
            }
            String title = "Put " + i + suffix + " from the top: ";
            Object o = GuiUtils.getChoiceOptional(title, topCards.toArray());
            if (o == null) break;
            Card c_1 = (Card) o;
            topCards.remove(c_1);
            AllZone.getGameAction().moveToLibrary(c_1, i - 1);
        }
        if (mayshuffle) {
            if (GameActionUtil.showYesNoDialog(src, "Do you want to shuffle the library?")) {
                player.shuffle();
            }
        }
    }