code: public static int unpackInt(final byte[] array, final JBBPIntCounter position) {
      final int code = array[position.getAndIncrement()] & 0xFF;
      if (code < 0x80) {
        return code;
      }
  
      final int result;
      switch (code) {
        case 0x80: {
          result = ((array[position.getAndIncrement()] & 0xFF) << 8) | (array[position.getAndIncrement()] & 0xFF);
        }
        break;
        case 0x81: {
          result = ((array[position.getAndIncrement()] & 0xFF) << 24)
              | ((array[position.getAndIncrement()] & 0xFF) << 16)
              | ((array[position.getAndIncrement()] & 0xFF) << 8)
              | (array[position.getAndIncrement()] & 0xFF);
        }
        break;
        default:
          throw new IllegalArgumentException("Unsupported packed integer prefix [0x" + Integer.toHexString(code).toUpperCase(Locale.ENGLISH) + ']');
      }
      return result;
    }
docs: Unpack an integer value from defined position in a byte array.
  
  @param array    the source byte array
  @param position the position of the first byte of packed value
  @return the unpacked value, the position will be increased