Guest User

Untitled

a guest
May 25th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.41 KB | None | 0 0
  1. public void bubbleSort() {
  2.     int n = hand.size();
  3.     for (int pass=1; pass < n; pass++) {  
  4.        
  5.         for (int i=0; i < n-pass; i++) {
  6.             if (hand.get(i).compareTo(hand.get(i+1))>0) {
  7.                
  8.                 Card temp = hand.get(i);  
  9.         hand.add(i,hand.get(i+1));
  10.         hand.remove(i+1);
  11.         hand.add(i+1,temp);
  12.             }
  13.         }
  14.     }
  15.     System.out.println(hand);
  16. }
  17.  
  18. }
Add Comment
Please, Sign In to add comment