code: public static void writeInt(ByteBuffer buf, int pos, int v) {
      buf.put(pos++, (byte) (0xff & (v >> 24)));
      buf.put(pos++, (byte) (0xff & (v >> 16)));
      buf.put(pos++, (byte) (0xff & (v >> 8)));
      buf.put(pos, (byte) (0xff & v));
    }
docs: Writes a specific integer value (4 bytes) to the output byte buffer at the given offset.
  
  @param buf output byte buffer
  @param pos offset into the byte buffer to write
  @param v int value to write