dp [ i ] [ j ] is going to store true if sum j is possible with array elements from 0 to i .
static boolean [ ] [ ] dp ; static void display ( ArrayList < Integer > v ) { System . out . println ( v ) ; }