aspose file tools
The moose likes Beginning Java and the fly likes finding the number of digits in an integer Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "finding the number of digits in an integer" Watch "finding the number of digits in an integer" New topic
Author

finding the number of digits in an integer

shree vijay
Ranch Hand

Joined: Sep 18, 2000
Posts: 208
Is there any method to find the number of digits in an integer?


Regards,<BR>Shree
Srinivasa Gajula
Greenhorn

Joined: Sep 26, 2000
Posts: 4
Vijay,
You can do something like this to get the number of digits.
int number = 999;
String s = new Integer(t).toString();
int len = s.length();
System.out.println("The length is " + len);
shree vijay
Ranch Hand

Joined: Sep 18, 2000
Posts: 208
thanks, the strategy works !!!
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: finding the number of digits in an integer
 
Similar Threads
octal number
How to get table's Integer field column size??
comparing digits in a number
number formatting????
A problem determining the length of an int variable converted to a string..........