Break a larger problem up into smaller problems. Solve each smaller problem individually and then combine the small solutions into the large solution for the whole problem.
In this case I can see two smaller problems to solve:
Convert a single ASCII character to its integer representation.
Combine the integer representations into the overall string
This has the feel of homework, so I'm not going to write a program for you, but I will help with some pseudocode:
myString <- "abc"
newString <- ""
for each character thisChar in myString
// Here "&" is the string concatenation operator
newString <- newString & convertToInteger(thisChar)
endfor
return newString
That is not Java, and there are a number of Java-specific tweaks that you should use in the Java version. You will learn them better if you find them for yourself. You could start by looking at the Javadocs for the StringBuilder
class.