Android Byte Array to Long Convert getLong(byte[] bb, int index)

Here you can find the source of getLong(byte[] bb, int index)

Description

get Long

Declaration

public static long getLong(byte[] bb, int index) 

Method Source Code

//package com.java2s;

public class Main {
    public static long getLong(byte[] bb, int index) {

        return ((((long) bb[index + 0] & 0xff) << 56)
                | (((long) bb[index + 1] & 0xff) << 48)
                | (((long) bb[index + 2] & 0xff) << 40)
                | (((long) bb[index + 3] & 0xff) << 32)
                | (((long) bb[index + 4] & 0xff) << 24)
                | (((long) bb[index + 5] & 0xff) << 16)
                | (((long) bb[index + 6] & 0xff) << 8) | (((long) bb[index + 7] & 0xff) << 0));

    }/*w w w . j a  v a  2 s  . co m*/
}

Related

  1. bytesLE2longs(byte[] b)
  2. bytesToLong(byte[] bytes)
  3. bytesToLong(byte[] bytes)
  4. bytesToLong(byte[] bytes, int start)
  5. bytes2ulong(byte[] bytes, int from, int to)
  6. getLong(byte[] bb, int index)
  7. getLong(byte[] buf, boolean bigEndian)
  8. getLong(byte[] buf, int pos, boolean bigEndian)
  9. getLong(byte[] bytes)