/guava/android/guava/src/com/google/common/math/BigIntegerMath.java
int productBits = LongMath.log2 ( product, FLOOR ) + 1; int bits = LongMath.log2 ( startingNumber, FLOOR ) + 1;
int approxSize = IntMath.divide(n * IntMath.log2(n, CEILING), Long.SIZE, CEILING); ArrayList<BigInteger> bignums = new ArrayList<>(approxSize); int startingNumber = LongMath.factorials.length; long product = LongMath.factorials[startingNumber - 1]; int shift = Long.numberOfTrailingZeros(product); product >>= shift; <extra_id_0> int nextPowerOfTwo = 1 << (bits - 1); for (long num = startingNumber; num <= n; num++) { if ((num & nextPowerOfTwo) != 0) { nextPowerOfTwo <<= 1; bits++; }