I am using a Java socket program to write integers and characters from the server back to the client
PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);
I want to write an int32 and a char of 8B on the wire. For the integer when I write
out.printf("%04x",1);
it appears on the wireshark as "30 30 30 31", whereas I want it to appear "01 00 00 00". Similarly for out.printf("%d",1); it appears as "31" whereas I want it "01 00 00 00". How can I write on the wire an integer of 4B and a character of 8B? Does the representation has to do with encoding?