public static long readLong(ByteBuff in, final int fitInBytes) {
    long tmpLength = 0;
    for (int i = 0; i < fitInBytes; ++i) {
      tmpLength |= (in.get() & 0xffl) << (8l * i);
    }
    return tmpLength;
  }
Read long which was written to fitInBytes bytes and increment position.
@param fitInBytes In how many bytes given long is stored.
@return The value of parsed long.
hbase-common/src/main/java/org/apache/hadoop/hbase/nio/ByteBuff.java