If you are using FileWriter, that does use text. The usual practice is to prepend a blank String in front of the number, eg.
int [] nums = { 3,1,2,55,6 };
FileWriter fout = new FileWriter("test.txt"); // fileName
for( int i = 0; i< nums.length; i++ )
fout.write(""+nums[2]);
fout.close();
-- or --
use the method of String
fout.write( String.valueOf( nums[0]) + " ");
-- or --
fout.write( String.format("%d ",nums[1] );
========
See, this allows us to 'format' the file with the delimeter and the line ending. If you were using a StreamWriter, that's binary and that requires other thinking, but you don't have to convert to String.