Java Byte Array to Long byte2long(byte[] data)

Here you can find the source of byte2long(byte[] data)

Description

bytelong

License

Open Source License

Declaration

public static final long byte2long(byte[] data) 

Method Source Code

//package com.java2s;

public class Main {

    public static final long byte2long(byte[] data) {
        if (data != null && data.length == 8) {
            return (((data[7] & 0xffL) << 56) | ((data[6] & 0xffL) << 48) | ((data[5] & 0xffL) << 40)
                    | ((data[4] & 0xffL) << 32) | ((data[3] & 0xffL) << 24) | ((data[2] & 0xffL) << 16)
                    | ((data[1] & 0xffL) << 8) | (data[0] & 0xffL));
        }/* ww  w. j a  v a  2  s .c  o  m*/
        return 0;
    }
}

Related

  1. bufferToLong(byte[] ioBuffer)
  2. byte2long(byte[] b)
  3. byte2long(byte[] b)
  4. byte2Long(byte[] bytes, int offset)
  5. byte2Long(byte[] bytes, int offset)
  6. byte2long(byte[] value, int count)
  7. byte2long(final byte[] v)
  8. bytes2long(byte[] b)
  9. bytes2long(byte[] byteArray, int offset)