Driver method
public static void main ( String args [ ] ) { int wt [ ] = { 4 , 8 , 9 } ; int val [ ] = { 2 , 4 , 6 } ; int K = 2 ; System . out . println ( maxWeight ( wt , val , K , wt . length ) ) ; } }