473,320 Members | 1,612 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,320 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 20778
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.