code: static public long unpackLong(byte[] ba, int index) {
      long result = 0;
      for (int offset = 0; offset < 64; offset += 7) {
        long b = ba[index++];
        result |= (b & 0x7F) << offset;
        if ((b & 0x80) == 0) {
          return result;
        }
      }
      throw new Error("Malformed long.");
    }
docs: Unpack positive long value from the byte array.
  <p>
  The index value indicates the index in the given byte array.
  
  @param ba byte array
  @param index index in ba
  @return the long value