L [ i ] = { MaxSum ( L [ j ] ) } + arr [ i ] where j < i and arr [ j ] . finish <= arr [ i ] . start
if ( ( arr . get ( j ) . finish <= arr . get ( i ) . start ) && ( findSum ( L . get ( j ) ) > findSum ( L . get ( i ) ) ) ) { ArrayList < Job > copied = new ArrayList < > ( L . get ( j ) ) ; L . set ( i , copied ) ; } } L . get ( i ) . add ( arr . get ( i ) ) ; } ArrayList < Job > maxChain = new ArrayList < > ( ) ;