File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes How to read numbers in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to read numbers in java" Watch "How to read numbers in java" New topic
Author

How to read numbers in java

teja dharma
Ranch Hand

Joined: Feb 07, 2009
Posts: 51
How to read numbers in java ?

[edit]Get rid of large red font. CR[/edit]


SCJP 5
Himalay Majumdar
Ranch Hand

Joined: Sep 28, 2008
Posts: 324
Click here.

I suggest its better to do your homework..research on the topic first, before asking questions. Also..Please try using normal font.


SCJP 1.6, SCWCD 5.0, SCBCD 5.0 [loading..]
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 1953
    
    7

What context are you basing your question on? If you want to convert strings to numbers (integer, double etc) then you can use Integer.parseInt(String) or Double.parseDouble(String) etc

The other way round is to use the toString() method of Integer or Double class.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD
Angelika Angley
Ranch Hand

Joined: Feb 17, 2009
Posts: 40
From left to the right!


[Blog] [SCJP6 75%] [SCBCD]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36453
    
  15
Agree about "normal font." But "left-to-right" is a bit steep, thank you. And we aren't that fond of the "let me Google that for you site." It is however, good for a laugh to try that link and see what it produces

K Tsang is right about Integer.parseInt() and Double.parseDouble(); in fact there are similar methods in most of the subclasses of the Number class (or the subclass constructors) for getting numbers out of Strings.
You can also read a number from a text file, keyboard input, etc, with the nextXXX() methods of the Scanner class.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to read numbers in java
 
Similar Threads
random number generation
random number generation
Number lists and bulleted lists
for Loops with PrintWriter
AP Computer Science assignment help