|
For example: 12 123 ... |
Problem:
|
|
Therefore: we need to convert the input (ASCII) representation to the internal int (2's complement) representation
In CS170/CS171, you have learned to use this method.
Example:
int i; String s = "123"; i = Integer.parseInt(s); // Convert string s to integer representation |
In CS255, we will reveal the secret inside the parseInt( ) method so you will understand the computer operation better.
Unlike the Boolean example, the conversion from ASCII representation of numbers to 2's complement representation of numbers is more complex and will take more than 1 webpage to explain....