Java - Trouver la longueur de BigInteger?

Java - Trouver la longueur de BigInteger?

En Java, nous pouvons convertir lesBigInteger en un objetString et obtenir la longueur de la chaîne.

JavaExample.java

package com.example;

import java.math.BigInteger;

public class JavaExample {

    public static void main(String[] args) {

        BigInteger bigInteger = BigInteger.valueOf(100000000000000000L); //18
        System.out.println(bigInteger.toString().length());

    }

}

Sortie

18