Basic HTML version of Foils prepared
18 May 97
Foil 20 ReverseString Class
From
Java Tutorial - Spring 1997 Part 4: Multithreading, useful Java classes, I/O, Networking, and the future Peking Tutorial, Web Certificate --
Spring-Summer 1997
.
by
Nancy J. McCracken,Geoffrey C. Fox
1
This class returns object of class String which reverses order of characters in input object source which is also an instance of class String
2
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();
}
}
in Table To:
©
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
.
Page produced by
wwwfoil
on Thu Jan 8 1998