code: private byte[] addPadding(byte[] plain) {
      byte plainpad[] = null;
      int shortage = 16 - (plain.length % 16);
      // if already an exact multiple of 16, need to add another block of 16
      // bytes
      if (shortage == 0) shortage = 16;
  
      // reallocate array bigger to be exact multiple, adding shortage bits.
      plainpad = new byte[plain.length + shortage];
      for (int i = 0; i < plain.length; i++) {
        plainpad[i] = plain[i];
      }
      for (int i = plain.length; i < plain.length + shortage; i++) {
        plainpad[i] = (byte) shortage;
      }
      return plainpad;
    }
docs: number in range 1..16).