I am having an issue with the use of FileOutputStream.write. I guess it does not let me write to a file using a String, so I tried changing the string to the primitive data type Byte[]. Now when I try to print it out, using the following for loop, it prints out result the as many times as the input is long.
Say I have 21345, instead of just printing out 21345 if prints out this below:
21345
21345
21345
21345
21345
for(int a=0; a<machineWord.length(); a++){
byte[] input = machineWord.getBytes();
out.write(input);
}
EDIT: I was reading Byte as an array, so I thought I had to loop through each position on Byte, to output the code. I just deleted the for loop which solved the problem.