import java.util.ArrayList; public class Towers { static ArrayList> pegs = new ArrayList>(); public static void move1(int from, int to) { int i = pegs.get(from).remove(0); pegs.get(to).add(0, i); printAll(); } public static void moveAll(int numtomove, int from, int to) { } public static void main(String[] args) { pegs.add(new ArrayList()); pegs.add(new ArrayList()); pegs.add(new ArrayList()); pegs.get(0).add(1); pegs.get(0).add(2); pegs.get(0).add(3); pegs.get(0).add(4); pegs.get(0).add(5); moveAll(pegs.get(0).size(), 0, 2); } public static void printAll() { int max = 0; //find max size for(int i = 0; i < pegs.size(); i++) { if(pegs.get(i).size() > max) { max = pegs.get(i).size(); } } for(int i = 0; i < max; i++) { for(int j = 0; j < pegs.size(); j++) { if(pegs.get(j).size() >= max-i) { System.out.print(pegs.get(j).get(i-(max-pegs.get(j).size())) + "\t"); } else { System.out.print("\t"); } } System.out.println(); } System.out.println("**********************"); } }