OUTFILE= new DataOutputStream(new FileOutputStream(PathFileOut));
Now I was wondering how to get that back. I used...
IN = new DataInputStream (new FileInputStream (PATHIN));
width = IN.readByte()
But when displaying that on screen it says 96, rather then 600. Am I doing something wrong? Is it due to the width being stored as more then two bytes or something?
Originally posted by Lora Tully:
It was part of my task and it had to be a writeByte and readByte. Thats the problem I am having. Is there a way of writing 600 in two bytes then and then reading 2 bytes? If I am remember one byte has 8 bits, so thats 256? so 2bytes would cover 600 but I dont know how to write it
I am a huge fan of schools that teach assembly language first. Students seem to develop a strong understanding and comfort level around bit-operators like &, |, !, >>, and <<... Or maybe I am bias because I spent too many years developing with assembly...
However, you don't have to get fancy. You can just divide by 100 for the high value. And get the remainder for the low value.
highvalue = x / 100;
lowvalue = x % 100;