1 |
This class returns an object of class String that reverses order of characters in its argument:
-
class ReverseString
-
{ public static String reverse( String s )
-
{ int i, len = s.length();
-
StringBuffer dest = new StringBuffer(len);
-
for( i = (len-1); i >= 0 ; i-- )
-
{ dest.append( s.charAt(i) );
-
}
-
return dest.toString();
-
}
-
}
|