Here you can find the source of getDigitCount(BigInteger number)
public static int getDigitCount(BigInteger number)
//package com.java2s; //License from project: Open Source License import java.math.BigInteger; public class Main { public static int getDigitCount(BigInteger number) { double factor = Math.log(2) / Math.log(10); int digitCount = (int) (factor * number.bitLength() + 1); if (BigInteger.TEN.pow(digitCount - 1).compareTo(number) > 0) { return digitCount - 1; }// www. jav a2s .c o m return digitCount; } }