private static byte [ ] padBytes ( byte [ ] bytes , int length ) { byte [ ] padded = new byte [ length ] ; for ( int i = 0 ; i < bytes . length ; i ++ ) { padded [ i ] = bytes [ i ] ; } return padded ; }
Return array with length size if length is greater than the previous size the array is zero - padded at the end .