Here you can find the source of bytesToLong(byte[] bytes)
Parameter | Description |
---|---|
bytes | the byte array |
public static long bytesToLong(byte[] bytes)
//package com.java2s; //License from project: Apache License public class Main { /**//from www . j a v a2 s .c om * Convert byte array to original long value. * * @param bytes the byte array * @return the original long value */ public static long bytesToLong(byte[] bytes) { long l = 0; for (int i = 0; i < 0 + 8; i++) { l <<= 8; l ^= bytes[i] & 0xFF; } return l; } }