question: public static List < List < String > > chunkRelativePaths ( List < String > files ) { ArrayList < List < String > > rc = new ArrayList < List < String > > ( ) ; int start = 0 ; int size = 0 ; int i = 0 ; for ( ; i < files . size ( ) ; i ++ ) { String p = files . get ( i ) ; if ( size + p . length ( ) > FILE_PATH_LIMIT ) { if ( start == i ) { rc . add ( files . subList ( i , i + 1 ) ) ; start = i + 1 ; } else { rc . add ( files . subList ( start , i ) ) ; start = i ; } size = 0 ; } else { size += p . length ( ) ; } } if ( start != files . size ( ) ) { rc . add ( files . subList ( start , i ) ) ; } return rc ; }
target:  Chunk paths on the command line