Interview Question

Software Engineer Interview(Student Candidate) Bloomington, IN

Write a program to implement the Integer.parseInt

  () function.
Answer

Interview Answer

1 Answer

0

//Assume that str only contains integers
int a=0;
for(int i=0; i<str.length(); i++){
a = (a *10)+ (str.getCharAt(i)-48);
}
return a

Robin on Jan 11, 2013

Add Answers or Comments

To comment on this Question, Sign In with Facebook or Sign Up