DataOutputStream writer = new DataOutputStream(new FileOutputStream("D:\\Eclipse\\workspace\\MyExperimentalProject\\files\\output.txt"));
writer.writeInt(a);
Writes an int to the underlying output stream as four bytes, high byte first. If no exception is thrown, the counter written is incremented by 4.
try (FileWriter fileWriter = new FileWriter("output.txt")) {
fileWriter.write(String.valueOf(5));
fileWriter.flush();
}