Given list of N arrays
ArrayList < ArrayList < Integer > > arr = new ArrayList < ArrayList < Integer > > ( ) ; arr . add ( new ArrayList < Integer > ( Arrays . asList ( - 3 , - 4 ) ) ) ; arr . add ( new ArrayList < Integer > ( Arrays . asList ( 1 , 2 , - 3 ) ) ) ;