Java Long Number Create toLong(byte[] key)

Here you can find the source of toLong(byte[] key)

Description

to Long

License

BSD License

Declaration

public static long toLong(byte[] key) 

Method Source Code

//package com.java2s;
// BSD License (http://lemurproject.org/galago-license)

public class Main {
    public static long toLong(byte[] key) {
        assert isLong(key);
        return (((long) key[0] << 56) + ((long) (key[1] & 255) << 48) + ((long) (key[2] & 255) << 40)
                + ((long) (key[3] & 255) << 32) + ((long) (key[4] & 255) << 24) + ((key[5] & 255) << 16)
                + ((key[6] & 255) << 8) + ((key[7] & 255) << 0));
    }/*  ww w. j  a  v a 2s .c  o  m*/

    public static boolean isLong(byte[] value) {
        return (value != null && value.length == 8);
    }
}

Related

  1. toLong(byte[] data)
  2. toLong(byte[] data)
  3. toLong(byte[] data)
  4. toLong(byte[] in)
  5. toLong(byte[] input)
  6. toLong(byte[] memory, int index)
  7. toLong(byte[] n)
  8. toLong(byte[] readBuffer, int o)
  9. toLong(byte[] si, boolean isReverseOrder)