Java BigInteger Calculate getDigitCount(BigInteger number)

Here you can find the source of getDigitCount(BigInteger number)

Description

get Digit Count

License

Open Source License

Declaration

public static int getDigitCount(BigInteger number) 

Method Source Code

//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;
    }
}

Related

  1. getBytesWithoutSign(BigInteger arg)
  2. getClearExpPipe(BigInteger M)
  3. getCreateLocalNextHopJobKey(Long vpnId, BigInteger dpnId, String prefix)
  4. getDateOf(BigInteger fileTime)
  5. getDateOf(final BigInteger fileTime)
  6. getHexString(BigInteger bigInt)
  7. getHistogramBigInt(List data, int breaks)
  8. getIntegral(String number, BigInteger def)
  9. getInterfaceName(final BigInteger datapathid, final String portName, final Integer vlanId)