I have made long
value from byte array using this code
byte[] by = {07, 53 -70, 74};
long value = 0;
for (int i = 0; i < by.length; i++) {
value = ((value << 8) + (by[i] & 0xff));
}
System.out.println(value);
out put is 520010
now I want reverse process on this and I tried it this way
long ts = 520010;
tm_stp[0] = (byte) ((byte) ts>>24);
tm_stp[1] = (byte) ((byte) ts>>16);
tm_stp[2] = (byte) ((byte) ts>>8);
tm_stp[3] = (byte) ts;
for (byte b : tm_stp) {
System.out.println(b);
}
and output is 0 0 0 74
what is wrong in my second part of code please help me, Thanks!