Android Byte Array to Long Convert bytes2long(byte[] b)

Here you can find the source of bytes2long(byte[] b)

Description

byteslong

License

Apache License

Declaration

public static long bytes2long(byte[] b) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static long bytes2long(byte[] b) {
        int mask = 0xff;
        int temp = 0;
        int res = 0;
        for (int i = 0; i < 8; i++) {
            res <<= 8;//from w  ww  .  java 2s  .co m
            temp = b[i] & mask;
            res |= temp;
        }
        return res;
    }
}

Related

  1. swap64bitFromArray(byte[] value, int offset)
  2. toLong(byte[] in)
  3. parseLong(byte[] b, int start, int end, int radix)
  4. parseLong(byte[] b, int start, int end)
  5. byteArrayToLong(byte[] arr)
  6. byteArrayToLong(byte[] b)
  7. byteArrayToLong(byte[] bArray)
  8. bytesBE2long(byte[] b, int off)