Driver code
public static void main ( String args [ ] ) { Stack < Integer > input = new Stack < Integer > ( ) ; input . push ( 10 ) ; input . push ( 3 ) ; input . push ( 2 ) ; input . push ( 6 ) ; input . push ( 12 ) ; int k = 4 ; sortStack ( input , k ) ; } }