question: public static List < byte [ ] > splitAndPad ( byte [ ] byteArray , int blocksize ) { List < byte [ ] > blocks = new ArrayList < byte [ ] > ( ) ; int numBlocks = ( int ) Math . ceil ( byteArray . length / ( double ) blocksize ) ; for ( int i = 0 ; i < numBlocks ; i ++ ) { byte [ ] block = new byte [ blocksize ] ; Arrays . fill ( block , ( byte ) 0x00 ) ; if ( i + 1 == numBlocks ) { int remainingBytes = byteArray . length - ( i * blocksize ) ; System . arraycopy ( byteArray , i * blocksize , block , 0 , remainingBytes ) ; } else { System . arraycopy ( byteArray , i * blocksize , block , 0 , blocksize ) ; } blocks . add ( block ) ; } return blocks ; }
target:  Splits the given array into blocks of given size and adds padding to the last one, if necessary.