Java Long Number Create toLong(byte... b)

Here you can find the source of toLong(byte... b)

Description

to Long

License

Open Source License

Declaration

public static long toLong(byte... b) 

Method Source Code

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

public class Main {

    public static long toLong(byte... b) {
        int mask = 0xff;
        int temp = 0;
        long res = 0;
        int byteslen = b.length;
        if (byteslen > 8) {
            return Long.valueOf(0L);
        }/*from  w  w w  . java 2 s.c o m*/
        for (int i = 0; i < byteslen; i++) {
            res <<= 8;
            temp = b[i] & mask;
            res |= temp;
        }
        return res;
    }
}

Related

  1. fromLongLE(byte src[], int offset, int numBytes)
  2. toLong(boolean b)
  3. toLong(boolean... a)
  4. toLong(byte b)
  5. toLong(byte byte7, byte byte6, byte byte5, byte byte4, byte byte3, byte byte2, byte byte1, byte byte0)
  6. toLong(byte... b)
  7. toLong(byte[] arr)
  8. toLong(byte[] array, int offset)
  9. toLong(byte[] b)