import java.io.*;
public class Main2 {
public static void main(String[] args) throws Exception {
DataOutputStream dos = new DataOutputStream(new FileOutputStream("Text.t"));
dos.writeByte(10101010);
DataInputStream dis = new DataInputStream(new FileInputStream("Text.t"));
int line;
System.out.println(dis.readByte());
dos.close();
dis.close();
}
}
i am trying to write 10101010 in a binary file that i create and print its content. When i run this it shows 18.. why? why not 10101010?Moreover when i open the Text.t file with textpad it contains this "rubbish" and not 10101010.