473,389 Members | 1,074 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,389 software developers and data experts.

How to find No. of Digits in a number

Hi every one,
Please tell me How to find No. of Digits in a number using java program?
Aug 4 '07 #1
3 20783
JosAH
11,448 Expert 8TB
Hi every one,
Please tell me How to find No. of Digits in a number using java program?
Just count them; you can either do that numerically (divide by ten all the time)
or make a string out of that number and check the string length. These tips
should be enough for you to cook up a nice little method that does the job.

kind regards,

Jos
Aug 4 '07 #2
Just count them; you can either do that numerically (divide by ten all the time)
or make a string out of that number and check the string length. These tips
should be enough for you to cook up a nice little method that does the job.

kind regards,

Jos

Hi,

Thanks a lot. I used the (String.valueOf(num)).length(). Its working.
Aug 6 '07 #3
JosAH
11,448 Expert 8TB
Hi,

Thanks a lot. I used the (String.valueOf(num)).length(). Its working.
Watch out for negative numbers though.

kind regards,

Jos
Aug 6 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: nospam | last post by:
Hi, I have an application whose textareas rows automatically resize onFocus to the number of lines in the textArea. The cols are set to 100% (in a CSS file) in order to always take the full...
3
by: sharugan | last post by:
Hi All, I have requirement to find out the number of pages in a document. The document could be DOC , TXT ,PDF images etc.I want to be able to upload and find out number of pages in an uploaded...
3
by: psbasha | last post by:
Hi, Without using list ,How to find a number is a digit or not?.Is there any global function is availabe in Python which says the number is a digit. Thanks in advance PSB
2
by: BlackEyesBlueTears | last post by:
i've been asked to write a program to find the number of times that a given word occurs in a sentence.sentence and the word both are to be take as input from the user. for example: EnTER A...
5
debasisdas
by: debasisdas | last post by:
A ten-digit number contains every digit from 0 to 9. The digits are arranged so that the number formed by the first two digits, reading from left to right, is divisible by 2, the number formed by...
2
by: dhanyamohans | last post by:
Hi All, how to find the number of users who visited my site using J2EE regards, Dhanya
11
by: C C++ C++ | last post by:
Hi all, got this interview question please respond. How can you quickly find the number of elements stored in a a) static array b) dynamic array ? Rgrds MA
7
by: jvdb | last post by:
Hello, I'm pretty new to Python. Can someone please show me how to find a number between 2 regular expressions? Something like this: Text: ' MyText (mymessage): 0 (Time ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.