| | |
String to int
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
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 |
911 actionlistener addressbook android api append applet application array arrays automation binary bluetooth character chat class classes client code component consumer csv database desktop draw eclipse error event exception fractal ftp game givemetehcodez graphics gui html ide image input integer j2me japplet java javaarraylist javac javaee javaprojects jmf jni jpanel julia linked linux list loop map method methods mobile netbeans newbie objects online oracle oriented panel print printf problem program programming project projects properties recursion replaydirector reporting researchinmotion robot rotatetext rsa scanner screen se server set size sms sort sql string swing template test threads time tree ubuntu update windows






