Here you can find the source of BitPrecisionInt(int numberValue)
static int BitPrecisionInt(int numberValue)
//package com.java2s; public class Main { static int BitPrecisionInt(int numberValue) { if (numberValue == 0) { return 0; }/*from w ww .j a va 2 s.c o m*/ int i = 32; { if ((numberValue >> 16) == 0) { numberValue <<= 16; i -= 8; } if ((numberValue >> 24) == 0) { numberValue <<= 8; i -= 8; } if ((numberValue >> 28) == 0) { numberValue <<= 4; i -= 4; } if ((numberValue >> 30) == 0) { numberValue <<= 2; i -= 2; } if ((numberValue >> 31) == 0) { --i; } } return i; } }