int    index    = 0;
Offset index    = Offset.zero();
  private void writeHeader()  {    if(VM_HardwarePerformanceMonitors.verbose>=2){ VM.sysWriteln("VM_TraceWriter.writeHeader() PID ",pid); }    byte[] buffer   = new byte[32+(10*100)];    // temporary buffer    int    index    = 0;        // write version number     int version_number = HPM_info.version_number;    if(VM_HardwarePerformanceMonitors.verbose>=4) {      VM.sysWriteln("VM_TraceWriter.writeHeader() version ",version_number);    }    if (HPM_info.isBigEndian()) {      VM_Magic.setIntAtOffset(buffer, index, version_number);    } else {      VM_Magic.setIntAtOffset(buffer, index, HPM_info.swapByteOrder(version_number));    }    index += VM_HardwarePerformanceMonitors.SIZE_OF_INT;    // write name of header file    if(VM_HardwarePerformanceMonitors.verbose>=4) {      VM.sysWriteln("VM_TraceWriter.writeHeader() write headerFilename \"",HPM_info.headerFilename(),"\"");    }    if (HPM_info.isBigEndian()) {      index = VM_HardwarePerformanceMonitors.writeStringToBuffer(buffer, index, HPM_info.headerFilename().getBytes());    } else {      index = VM_HardwarePerformanceMonitors.writeStringToBufferSwapBytes(buffer, index, HPM_info.headerFilename().getBytes());    }    // write header to file.    writeFileOutputStream(buffer, index);  }