Reputation: 2909
I've created a file.txt with the string "7F" in it. I read it using apaches library:
byte[] byteArray = IOUtils.toByteArray(new Base64InputStream(new java.io.FileInputStream(fileName)));
And this is the array I get:
[-20]
which equates to 1110 1100 when i was expecting 1111 1111 I guess my question is how to encode a string in ascii which would generate the Byte 1111 1111?
Upvotes: 0
Views: 127
Reputation: 1188
You will have to use the ASCII Character:'ÿ'
The following code should get you what you want:
Character s= 'ÿ';
System.out.println(Integer.toBinaryString(s));
You can use an online utility like: https://www.branah.com/ascii-converter to help you out.
Upvotes: 1