Utility function to calculate sum of all ArrayList elements
static int findSum ( ArrayList < Job > arr ) { int sum = 0 ; for ( int i = 0 ; i < arr . size ( ) ; i ++ ) sum += arr . get ( i ) . profit ; return sum ; }