Here you can find the source of bytes2ulong(byte[] bytes, int from, int to)
public static long bytes2ulong(byte[] bytes, int from, int to)
//package com.java2s; public class Main { public static long bytes2ulong(byte[] bytes, int from, int to) { long result = 0; int len = to - from; for (int i = from; i < to; i++) { int shiftValue = (to - i - 1) * 8; result += (bytes[i] << shiftValue) & (0xFFFFFFFF >>> ((len - 1) * 8 - shiftValue)); }//from w ww . ja v a 2 s. co m return result; } }