Here you can find the source of unsignedVLQSize(int value)
static int unsignedVLQSize(int value)
//package com.java2s; /*// w w w . j av a 2s . c o m * Copyright (c) 2011-2013 Spotify AB * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ public class Main { static int unsignedVLQSize(int value) { if (value < 1 << 7) { return 1; } if (value < 1 << 14) { return 2; } if (value < 1 << 21) { return 3; } if (value < 1 << 28) { return 4; } return 5; } static int unsignedVLQSize(long value) { if (value < 1L << 7) { return 1; } if (value < 1L << 14) { return 2; } if (value < 1L << 21) { return 3; } if (value < 1L << 28) { return 4; } if (value < 1L << 35) { return 5; } if (value < 1L << 42) { return 6; } if (value < 1L << 49) { return 7; } if (value < 1L << 56) { return 8; } return 9; } }