Quantcast
Channel: web development helpdesk » long
Viewing all articles
Browse latest Browse all 4

How to convert byte array to long

$
0
0
The following code can be used to convert a byte array (containing the bytes of a long) into a long. public static long byteArrayToLong(byte[] bytes) { long l = 0; for (int i=0; i<8; i++) { l <<= 8; l ^= (long) bytes[i] & 0xff; } return l; } This is the reverse of “How […]

Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images