private int writeEntryHeaderField(
     long value, byte[] outbuf, int offset, int length, boolean starMode) {
   if (!starMode && (value < 0 || value >= (1l << (3 * (length - 1))))) {
     // value doesn't fit into field when written as octal
     // number, will be written to PAX header or causes an
     // error
     return TarUtils.formatLongOctalBytes(0, outbuf, offset, length);
   }
   return TarUtils.formatLongOctalOrBinaryBytes(value, outbuf, offset, length);
 }