In this approach, we are not going to use any predefined methods for conversion. we are going to write our own algorithm for this purpose.

The algorithm is simple, we are going to iterate through each character of the give String and convert it to digit. we maintain a temporary integer for calculating the result. Below is the step by step procedure.

Algorithm:

1. Initialize a temporary integer to 0. which represents the result. int num = 0;
2. Iterate through each character of the given string.char aChar; for(int i = 0; i < aString.length(); i++) { aChar = aString.charAt(i);
3. Check if the character is digit or not. If it is a digit, then convert it to integer, else throw an exception.Character.isDigit(aChar);
4. You can convert the character to integer, by subtracting '0' from it. aChar - '0'; // converts the character to integer
5. For each converted integer, multiply temporary integer with 10 and add the converted integer to it. num = (num * 10) + (aChar - '0');
6. Finally return the result.