public static byte[] padArray(byte[] array,byte value,int newLength){
  int length=array.length;
  int paddingLength=newLength - length;
  if (paddingLength < 1) {
    return array;
  }
 else {
    byte[] padding=new byte[paddingLength];
    Arrays.fill(padding,value);
    return concatenate(array,padding);
  }
}

public static byte [ ] padArray ( byte [ ] array , byte value , int newLength ) { int length = array . length ; int paddingLength = newLength - length ; if ( paddingLength < 1 ) { return array ; } else { byte [ ] padding = new byte [ paddingLength ] ; Arrays . fill ( padding , value ) ; return concatenate ( array , padding ) ; } }
adds a padding to the given array , such that a new array with the given length is generated .
