Please read my question carefully, then judge if it is duplicate
I am green. If there is any mistake in my description please help me figure it out
I want to parse a binary file by java. the first pic is the file opened by hex editor, you can see from 000000 0 to 000000 3 is ef ef ef ef
here is my code
String filepath = "D:\\CHR_2_20151228132500.dat.gz";
File file = new File(filepath);
FileInputStream fis = new FileInputStream(file);
GZIPInputStream gzip = new GZIPInputStream(fis);
DataInputStream din = new DataInputStream(gzip);
byte[] bytes = new byte[20];
din.read(bytes, 0, 4);
for (byte b : bytes) {
String str = Integer.toHexString(b);
System.out.print(str);
}
this is the result I parse you can see there is ffffff between each ef and several zero appended
I want get data as same as it in hex editor.how can I get this ?