Java Byte Array to Long byteToLong(byte[] byteArray)

Here you can find the source of byteToLong(byte[] byteArray)

Description

byte To Long

License

Open Source License

Declaration

public static long byteToLong(byte[] byteArray) 

Method Source Code

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

public class Main {
    public static long byteToLong(byte[] byteArray) {
        return (((long) (byteArray[0]) & 0xFF) << 56) | (((long) (byteArray[1]) & 0xFF) << 48)
                | (((long) (byteArray[2]) & 0xFF) << 40) | (((long) (byteArray[3]) & 0xFF) << 32)
                | (((long) (byteArray[4]) & 0xFF) << 24) | (((long) (byteArray[5]) & 0xFF) << 16)
                | (((long) (byteArray[6]) & 0xFF) << 8) | ((long) (byteArray[7]) & 0xFF);
    }/*from ww w. j  av  a 2s. com*/
}

Related

  1. bytesToLong(final byte[] data, final int offset)
  2. bytesToLongLE(byte[] bytes, int off)
  3. byteToLong(byte[] b)
  4. byteToLong(byte[] b)
  5. byteToLong(byte[] buf, int off)
  6. byteToLong(byte[] bytesToConvert)
  7. byteToLong(byte[] i_Value)
  8. byteToLong(byte[] values)
  9. byteToLong(final byte[] b)