public static byte [ ] rjust ( byte [ ] bytes , int width ) { if ( bytes . length >= width ) { return Arrays . copyOfRange ( bytes , bytes . length - width , bytes . length ) ; } else { byte [ ] rjustied = new byte [ width ] ; System . arraycopy ( bytes , 0 , rjustied , width - bytes . length , bytes . length ) ; return rjustied ; } }
Modifies the length of a byte array by padding zero bytes to the left .