The idea is to put the last character of the original string as the first character of the resultant string, the second last character of the original string as the second character of the resultant string, and so on. So, supposing you need to flip a String (ugh, capitalised "String", Java habit ) variable and put it in another String variable, you would do it like:

code:

var string1 : string := "abcdefg"
var string2 : string := ""

for decreasing i : length(string1) .. 1
% so here, we're looping from the last character of string1 to the first.
% note that we're storing the nth character of the
% original string as the (length(string1)-n)th character of string2, so...
string2 += string1 (i)
end for

% string2 should be "gfedcba" now.

Everything else should be self-explanatory. Convert your integer to a String, reverse it using the above algorithm, and convert the resultant String back into an integer... Ta-da.