HELP! * YELLOW=global GREY=local Global HTML version of Foils prepared 4 February 97
Foil 38 ReverseString Class
From Feb 3 Delivered Lecture for Course CPS616 -- Java Lecture 4 -- AWT Through I/O CPS616 spring 1997 -- Feb 3 1997. byNancy McCracken * Critical Information in IMAGESecs 11.5
This class returns object of class String which reverses order of characters in input object source which is also an instance of class String
class ReverseString {
public static String reverseIt(String source) {
int i, len= source.length();
StringBuffer dest = new StringBuffer(len);
for( i= (len-1); i >=0 ; i--) {
dest.append(source.charAt(i));
}
return dest.toString();
}
}
Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.