Guest User

Untitled

a guest
Jun 12th, 2010
105
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package workplace;
  2.  
  3. import com.google.common.base.Joiner;
  4. import java.util.ArrayList;
  5. import java.util.Collections;
  6. import java.util.List;
  7.  
  8. public class Main {
  9.  
  10.     public static void main(String[] args) {
  11.         final int depth = 6;
  12.  
  13.         final List<Integer> itemsList = new ArrayList<Integer>();
  14.         for (int item=1;item<=depth;item++) {
  15.             itemsList.add(item);
  16.             if (itemsList.size()%2!=0) {
  17.                 Collections.sort(itemsList);
  18.             } else {
  19.                 Collections.sort(itemsList, Collections.reverseOrder());
  20.             }
  21.             System.out.println(Joiner.on("-").join(itemsList));
  22.         }
  23.     }
  24. }
RAW Paste Data