LinkedIn interview question

Implement Integer.parseInt from scratch

Interview Answers

Anonymous

4 Aug 2011

to study for this interview I suggest rewriting all of the basic Java methods ;)

1

Anonymous

23 Feb 2012

can't u just parse char by char and use a bunch of shift operators and since ur just using charAt(i) to pick up a character u can use the same i and just raise it to the power of 10 and just or it with some bytes

1

Anonymous

12 May 2012

public static int parseInt(String stringToConvert) { int i =0,num=0; int isNeg = 1; int length = stringToConvert.length(); if(stringToConvert.charAt(0) =='-') { isNeg=-1; i=1; } while(i