code: protected int getPadding(int size, boolean compressed)
      {
          int padding;
          //data not packed in the tag
          if ( !compressed )
          {    
              int b;
              padding = ( b = ( ((size/sizeOf())%(8/sizeOf()))*sizeOf() ) ) !=0   ? 8-b : 0;
          }
          else //data _packed_ in the tag (compressed)
          {
              int b;
              padding = ( b = ( ((size/sizeOf())%(4/sizeOf()))*sizeOf() ) ) !=0   ? 4-b : 0;
          }
          return padding;
      }
docs: Calculate padding