Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Instant Grammar Checker - Correct all grammar errors and enhance your writing

What's The REAL Secret To First Date Success With a Woman? Click Here To Find Out

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

29,372 questions

38,322 answers

573 users

How to get the length of a number in Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
        int num = 823420;

        int length = (int)(Math.log10(num) + 1);
        
        System.out.println(length);
    }
}




/*
run:

6

*/

 


Protect Your Privacy - Download VPN


answered Sep 22, 2022 by avibootz

Related questions

1 answer 43 views
2 answers 115 views
115 views asked Nov 25, 2016 by avibootz
1 answer 62 views
...