main function
public static void main ( String args [ ] ) { Stack < Integer > s1 = new Stack < Integer > ( ) ; Stack < Integer > s2 = new Stack < Integer > ( ) ; s1 . push ( 34 ) ; s1 . push ( 3 ) ; s1 . push ( 31 ) ; s2 . push ( 1 ) ; s2 . push ( 12 ) ; s2 . push ( 23 ) ; sortedMerge ( s1 , s2 ) ; System . out . println ( " Sorted ▁ and ▁ merged ▁ stack ▁ : " ) ; while ( tmpStack . size ( ) != 0 ) { System . out . print ( tmpStack . peek ( ) + " ▁ " ) ; tmpStack . pop ( ) ; } } }