Two options come to my mind.
Option 1:
If you don't want to lose your stack, don't pop the elements - just iterate though your stack:
public void display(Stack<Integer> stackToDisplay){
Stack<Integer> tmpStack = stackToDisplay;
for(Integer element : stackToDisplay) {
System.out.println(element);
}
}
The reason why the stack is empty after the first call is because it gets passed as reference and therefore any changes made in display()
will have an effect on your real object.
Here is another way to iterate:
Iterator<Integer> iter = tmpStack.iterator();
while (iter.hasNext()){
System.out.println(iter.next());
}
Option 2:
If you don't want this behavior at you could create a copy of your object - but I don't think that this is necessary in your case. A copy would only be necessary if you'd like to have two different Stacks later on. For that take a look at this question where you can find out how that works. Note that copying objects is always slower than passing references.