code: private static int[] readUncompressedLength(byte[] compressed, int compressedOffset)
          throws CorruptionException {
          int result;
          int bytesRead = 0;
          {
              int b = compressed[compressedOffset + bytesRead++] & 0xFF;
              result = b & 0x7f;
              if ((b & 0x80) != 0) {
                  b = compressed[compressedOffset + bytesRead++] & 0xFF;
                  result |= (b & 0x7f) << 7;
                  if ((b & 0x80) != 0) {
                      b = compressed[compressedOffset + bytesRead++] & 0xFF;
                      result |= (b & 0x7f) << 14;
                      if ((b & 0x80) != 0) {
                          b = compressed[compressedOffset + bytesRead++] & 0xFF;
                          result |= (b & 0x7f) << 21;
                          if ((b & 0x80) != 0) {
                              b = compressed[compressedOffset + bytesRead++] & 0xFF;
                              result |= (b & 0x7f) << 28;
                              if ((b & 0x80) != 0) {
                                  throw new CorruptionException("last byte of compressed length int has high bit set");
                              }
                          }
                      }
                  }
              }
          }
          return new int[] { result, bytesRead };
      }
docs: Reads the variable length integer encoded a the specified offset, and
  returns this length with the number of bytes read.