Write a complete java program that provides a method named collapse, which takes a stack of integers as a parameter and that collapses it by replacing each successive pair of integers with the sum of the pair. If the stack stores an add number of elements, the final element is not collapsed.
You may use one Queue as auxilliary storage.