VM_Magic.setIntAtOffset(buffer, index, id);                 index += SIZE_OF_INT;
VM_Magic.setIntAtOffset(buffer, index, id);                 index = index.add(BYTES_IN_INT);
  static private void writeEvent(int counter, int id, String name)  {    if(verbose>=4) {      VM.sysWrite  ("VM_HPMs.writeEvent(",counter,",");      VM.sysWrite  (id,", length ",name.length());      VM.sysWriteln(" ",name);    }    int index = 0;    byte[] buffer = new byte[name.length()+16];    // write record format number    VM_Magic.setIntAtOffset(buffer, index, EVENT_RECORD);       index += SIZE_OF_INT;    // write counter number    VM_Magic.setIntAtOffset(buffer, index, counter);            index += SIZE_OF_INT;    // write event number    VM_Magic.setIntAtOffset(buffer, index, id);                 index += SIZE_OF_INT;    // write event name    index = writeStringToBuffer(buffer, index, name.getBytes());    // write buffer to file    writeHeaderFileOutputStream(buffer, index);  }