size static method

int size(
  1. int value
)

Get size of variable integer encoding

Implementation

static int size(int value) {
  if (value < 0xFD) return 1;
  if (value <= 0xFFFF) return 3;
  if (value <= 0xFFFFFFFF) return 5;
  return 9;
}