Java Byte Array to Long bytesToLong(byte[] arr, int offset)

Here you can find the source of bytesToLong(byte[] arr, int offset)

Description

bytes To Long

License

Open Source License

Declaration

public static long bytesToLong(byte[] arr, int offset) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static long bytesToLong(byte[] arr, int offset) {
        long num = (long) ((arr[offset + 0] & 0xFF) << 56) | (long) ((arr[offset + 1] & 0xFF) << 48)
                | (long) ((arr[offset + 2] & 0xFF) << 40) | (long) ((arr[offset + 3] & 0xFF) << 32)
                | (long) ((arr[offset + 4] & 0xFF) << 24) | (long) ((arr[offset + 5] & 0xFF) << 16)
                | (long) ((arr[offset + 6] & 0xFF) << 8) | (long) ((arr[offset + 7] & 0xFF) << 0);

        return num;
    }/*from  w ww.  j a v a  2 s  .co  m*/
}

Related

  1. bytes2Long(final byte[] b)
  2. bytes2long(final byte[] bytes, final int start)
  3. bytesToLong(byte a, byte b, byte c, byte d)
  4. bytesToLong(byte a, byte b, byte c, byte d, byte e, byte f, byte g, byte h, boolean swapBytes)
  5. bytesToLong(byte[] a, int ao)
  6. bytesToLong(byte[] array, int offset)
  7. bytesToLong(byte[] b)
  8. bytesToLong(byte[] b)
  9. bytesToLong(byte[] b)