public void write(String file, String user, String field, String week, int mode) {
    if (mode == 1) {
      for (int i = 0; i < this.first_field.length; i++) {
        if (this.first_field[i].compareTo(user) == 0) {
          this.second_field[i] = week;
          this.third_field[i] = field + "\r";
          break;
        }
      }
    } else if (mode == 2) {
      for (int i = 0; i < this.first_field.length; i++) {
        if (this.first_field[i].compareTo(user) == 0) {
          if (this.second_field[i].compareTo(week) == 0) {
            this.third_field[i] = field + "\r";
            break;
          }
        }
      }
    }
    String output = "";
    for (int i = 0; i < this.first_field.length; i++) {
      if (this.first_field[i].compareTo("\r") != 0 && this.first_field[i].compareTo("") != 0) {
        output +=
            this.first_field[i] + "--" + this.second_field[i] + "--" + this.third_field[i] + "\n";
      } else {
        output += "\r\n";
      }
    }

    writeTextFile(file, output);
  }