code: public static void writeSecurityBuffer(short length, short allocated,
              int bufferOffset, byte[] b, int offset) {
          ByteUtilities.writeShort(length, b, offset);
          ByteUtilities.writeShort(allocated, b, offset + 2);
          ByteUtilities.writeInt(bufferOffset, b, offset + 4);
      }
docs: Writes a security buffer to the given array <code>b</code> at offset
  <code>offset</code>. A security buffer defines a pointer to an area
  in the data that defines some data with a variable length. This allows
  to have a semi-fixed length header thus making a little bit easier
  the decoding process in the NTLM protocol.
  
  @param length the length of the security buffer
  @param allocated the allocated space for the security buffer (should be
  greater or equal to <code>length</code>
  @param bufferOffset the offset from the main array where the currently
  defined security buffer will be written
  @param b the buffer in which we write the security buffer
  @param offset the offset at which to write to the b buffer