Java Byte Array to Long bytesToLong(byte[] bytes)

Here you can find the source of bytesToLong(byte[] bytes)

Description

bytes To Long

License

Apache License

Declaration

public static long bytesToLong(byte[] bytes) 

Method Source Code

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

public class Main {
    public static long bytesToLong(byte[] bytes) {
        return (0xffL & (long) bytes[0]) | (0xff00L & ((long) bytes[1] << 8))
                | (0xff0000L & ((long) bytes[2] << 16)) | (0xff000000L & ((long) bytes[3] << 24))
                | (0xff00000000L & ((long) bytes[4] << 32)) | (0xff0000000000L & ((long) bytes[5] << 40))
                | (0xff000000000000L & ((long) bytes[6] << 48)) | (0xff00000000000000L & ((long) bytes[7] << 56));
    }//from  w ww  .  j av a 2s  .  c o m
}

Related

  1. bytesToLong(byte[] b)
  2. bytesToLong(byte[] bs)
  3. bytesToLong(byte[] buf, int offset, int length, boolean asc)
  4. bytesToLong(byte[] bytes)
  5. bytesToLong(byte[] bytes)
  6. bytesToLong(byte[] bytes)
  7. bytesToLong(byte[] bytes)
  8. bytesToLong(byte[] bytes)
  9. bytesToLong(byte[] bytes, int index)