First ignore all the whitespaces. Remember the sign by using a sign variable and simply "form" a number by appending the digits encountered. If the number exceeds Integer.MAX_VALUE we return ...