public static long getLongFromBytes(byte[] bytes,
                                        int    offset)
    {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "getLongFromBytes: length = " + bytes.length + ", data = " + toHexString(bytes));
        long result = -1;
        if (bytes.length >= offset + 8)
        {
            result = ((bytes[0 + offset]&0xff) << 56) +
                     ((bytes[1 + offset]&0xff) << 48) +
                     ((bytes[2 + offset]&0xff) << 40) +
                     ((bytes[3 + offset]&0xff) << 32) +
                     ((bytes[4 + offset]&0xff) << 24) +
                     ((bytes[5 + offset]&0xff) << 16) +
                     ((bytes[6 + offset]&0xff) << 8) +
                      (bytes[7 + offset]&0xff);
        }
        if (tc.isEntryEnabled()) Tr.exit(tc, "getLongFromBytes " + result);

        return result;
    }
public static long getLongFromBytes ( byte [ ] bytes , int offset ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getLongFromBytes: length = " + bytes . length + ", data = " + toHexString ( bytes ) ) ; long result = - 1 ; if ( bytes . length >= offset + 8 ) { result = ( ( bytes [ 0 + offset ] & 0xff ) << 56 ) + ( ( bytes [ 1 + offset ] & 0xff ) << 48 ) + ( ( bytes [ 2 + offset ] & 0xff ) << 40 ) + ( ( bytes [ 3 + offset ] & 0xff ) << 32 ) + ( ( bytes [ 4 + offset ] & 0xff ) << 24 ) + ( ( bytes [ 5 + offset ] & 0xff ) << 16 ) + ( ( bytes [ 6 + offset ] & 0xff ) << 8 ) + ( bytes [ 7 + offset ] & 0xff ) ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getLongFromBytes " + result ) ; return result ; }
Utility function which extracts a long from a byte array representation in big endian format