question: public List < PdfDocument > splitBySize ( long size ) { List < PageRange > splitRanges = new ArrayList < > ( ) ; int currentPage = 1 ; int numOfPages = pdfDocument . getNumberOfPages ( ) ; while ( currentPage <= numOfPages ) { PageRange nextRange = getNextRange ( currentPage , numOfPages , size ) ; splitRanges . add ( nextRange ) ; List < Integer > allPages = nextRange . getAllPages ( ) ; currentPage = ( int ) allPages . get ( allPages . size ( ) - 1 ) + 1 ; } return extractPageRanges ( splitRanges ) ; }
target:  Splits the document basing on the given size.