Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void bubbleSort() {
- int n = hand.size();
- for (int pass=1; pass < n; pass++) {
- for (int i=0; i < n-pass; i++) {
- if (hand.get(i).compareTo(hand.get(i+1))>0) {
- Card temp = hand.get(i);
- hand.add(i,hand.get(i+1));
- hand.remove(i+1);
- hand.add(i+1,temp);
- }
- }
- }
- System.out.println(hand);
- }
- }
Add Comment
Please, Sign In to add comment