When i want to write a text in a file i converted it to a byte and then save it in a byte array and then send it with the FileOutputStream to the file. What should i do if i want to write an integer ??
String filename = "testFile.txt";
OutputStream os = new FileOutputStream(filename);
String someText = "hello";
byte[] textAsByte = someText.getBytes();
os.write(textAsByte);
int number = 20;
byte numberAsByte = number.byteValue();
os.write(numberAsByte);
I am getting (Hello) expected result: Hello20