Is there already a rot13() and unrot13() implementation as part of one of the standard Java libraries? Or do I have to write it myself and \"reinv
I don't think it's part of Java by default, but here's an example of how you can implement it;
public class Rot13 {
public static void main(String[] args) {
String s = args[0];
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c >= 'a' && c <= 'm') c += 13;
else if (c >= 'A' && c <= 'M') c += 13;
else if (c >= 'n' && c <= 'z') c -= 13;
else if (c >= 'N' && c <= 'Z') c -= 13;
System.out.print(c);
}
System.out.println();
}
}
Source: http://introcs.cs.princeton.edu/java/31datatype/Rot13.java.html