C
chuck
Hello,
I am trying to write integer values, 0 - 255 to a file and am having problems.
I am having problems writing any value greater than 127 (out of ascii
range), i get random values.
the full test code is here
http://pastebin.ca/743174
ok, now what i am trying to do
I break up a java long variable into 4 bytes. so first i convert the
value to a binary string with left padded 0s. (i will just show the
first byte)
Writer outfile = new FileWriter("testOutput");
String encryptedString = padString(Long.toBinaryString(value), -32, "0");
String bs0 = encryptedString.substring(0, 7+1);
int eByte0 = Integer.parseInt( bs0, 2);
outfile.write( eByte0 );
here is an example
5955599
00000000010110101110000000001111
00000000 01011010 11100000 00001111
0 90 224 15
expected value in hex editor
00 5a e0 0f
actual value value in hex editor
00 5A 88 0F
Any help is appreciated.
Chuck
I am trying to write integer values, 0 - 255 to a file and am having problems.
I am having problems writing any value greater than 127 (out of ascii
range), i get random values.
the full test code is here
http://pastebin.ca/743174
ok, now what i am trying to do
I break up a java long variable into 4 bytes. so first i convert the
value to a binary string with left padded 0s. (i will just show the
first byte)
Writer outfile = new FileWriter("testOutput");
String encryptedString = padString(Long.toBinaryString(value), -32, "0");
String bs0 = encryptedString.substring(0, 7+1);
int eByte0 = Integer.parseInt( bs0, 2);
outfile.write( eByte0 );
here is an example
5955599
00000000010110101110000000001111
00000000 01011010 11100000 00001111
0 90 224 15
expected value in hex editor
00 5a e0 0f
actual value value in hex editor
00 5A 88 0F
Any help is appreciated.
Chuck