| | |
String to int
![]() |
•
•
Join Date: Feb 2008
Posts: 28
Reputation:
Solved Threads: 1
•
•
•
•
97 is the byte value of 'a'. Your read() call just got a single byte and converted it to int.
In any case, it's irrelevant. Without a stated encoding expectation, "asu" cannot be converted to int. Integer.parseInt() will convert a valid integer string to an int value. If you want to convert some other string to an int, there are many different ways to do so, but they are specific encoding methods - not just a general api call or statement.
•
•
Join Date: Feb 2008
Posts: 28
Reputation:
Solved Threads: 1
•
•
•
•
Integer.parseInt() was already explained. The real point is that there is no generic method to make "asu" an int. It is totally dependent upon how you need to encode the string and that is totally dependent on what you intend to use it for.
int x = br.read();
int y=br.read();
int z=br.read();
System.out.println(x+y+z);
Please do reply me.
You can write whatever you want if this is the way you want to convert "asu" to a String. As it was said in the first reply what do you want to convert "asu" to?
Check out my New Bike at my Public Profile at the "About Me" tab
![]() |
Similar Threads
- Problems from string to int array (C)
- string to int conversion (C++)
- String to Int (C++)
- "String class" (Java)
- Return Length of a string? (C++)
Other Threads in the Java Forum
- Previous Thread: NoClassDefFounderError
- Next Thread: Java Paint Program Question
| Thread Tools | Search this Thread |
add android api applet application applications array arrays automation bank binary bluetooth chat class clear client code codesnippet collections component converter database development dice digit eclipse equation error event formatingtextintooltipjava fractal functiontesting game givemetehcodez graphics gui health html hyper ide idea image infinite input int integer j2me java javame javaprojects jni jpanel julia linux list loop looping main map method methods mobile myregfun mysql netbeans newbie nonstatic openjavafx parameter pearl php print problem program programming project recursion repositories scanner scrollbar server set size sms sort sorting spamblocker sql sqlserver state storm string superclass swing swt text-file thread threads tree windows






