#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2011
    Posts
    6
    Rep Power
    0

    Convert String to Int


    how to convert a String value to an int without
    using any java library functions nor wrapper classes

    if the string value is "123"
    then the int value is also come as 123.
  2. #2
  3. Java Junkie
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Feb 2004
    Location
    Mobile, Alabama
    Posts
    4,023
    Rep Power
    1285
    Look at java.lang.Integer.
  4. #3
  5. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,724
    Rep Power
    348
    without using any java library functions nor wrapper classes
    Is your assignment to take a String: "123" and using String methods and some math, convert it to the int: 123?
    Look at 123 this way as the sum of:
    1 * 10^2
    2 * 10^1
    3 * 10^0

IMN logo majestic logo threadwatch logo seochat tools logo