public static void main(String[] args) throws IOException {
    String fileName = "C:\\Users\\Sandark\\Documents\\result.txt";

    String text = "Юные археологи\r\nПытаются свести\r\nСвои счета на Родине\r\nНа Родине отцов";
    int nine = 9;
    char[] array = text.toCharArray();
    String arrayString = array.toString();
    FileConsoleWriter writer = new FileConsoleWriter(fileName);

    writer.write(text);
    writer.write(nine);
    writer.write(array);

    writer.close();
  }
 public static void main(String[] args) throws IOException {
   FileConsoleWriter fileConsoleWriter = new FileConsoleWriter("jan");
   fileConsoleWriter.write("Проверка String:");
   fileConsoleWriter.write(1234);
   char[] buff = "Проверка char buff:".toCharArray();
   fileConsoleWriter.write(buff);
   fileConsoleWriter.write(buff, 3, 5);
   fileConsoleWriter.write("Проверка String обрезка:", 0, 2);
   fileConsoleWriter.flush();
   fileConsoleWriter.close();
 }