Hi,
I'm trying to read from a text file into a byte[] array, and then convert that byte array into hex code.
The problem i have is assigning the length of my array. At the moment my code looks as such;
----------------------------------------
FileInputStream fis = new FileInputStream(file);
// R E A D
byte[] ba = new byte[1024];
// -1 means eof
int bytesRead;
bytesRead = fis.read( ba, 0 /* offset in ba */, ba.length /* bytes to read */ );
return ba;
}
-------------------------------------------
i've set my byte to the value of 1024. Which gives me alot of zeros, but i get the right hex input into the start of the array.
i need to make the length only as long as the next greatest power of 64bit (8 bytes). (and pad to complete the fields)
The covered quotient looks as follows
(dividend >= 0) ? ( (dividend + divisor - 1 ) / divisor) : (dividend / divisor );
however i do not know how to implement that ..
Any help would be much appreciated. .
John