need to iterrate over individual 8 bytes in a long variable
I have a long varibale called transactionId.
private long transactionId;
As you know in java this long variable takes 8 byes of space. For the application
I am working on now. i have send the data in the firm of bytes over the netweok
I need to iterate over each byte of this long variable and check what is
coming into each byte of the long value.
there are no methods in java to load a long value into a byte array and to
iterate over each byte..also there are no methods like Sting such as String.getBytes()
to get the bytes.....hence I am not quiet sure as to how to do it. One of
my friends suggested that I could use BITWISE and SHIFT operators to check
for the indivdual bytewise represenation of values in the 8 bytes of a long
variable. This seems to be a bit complicated to me, as I haven't got much
about the operators...It will be very good if some can give an idea as to
how to do it. I am stuck up with my work and I wasted few hours on trying
to this. Please help me in the matter....
lets say I am expecting a solution like......say...
using a for loop, I should be able to iterate over each BYTE in the long
variable and see what is coming into that.....
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center