Skip to content

Instantly share code, notes, and snippets.

@lazywithclass
Created November 19, 2011 00:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lazywithclass/1378190 to your computer and use it in GitHub Desktop.
Save lazywithclass/1378190 to your computer and use it in GitHub Desktop.
Invert a string (the inefficient way)
public static String invert(String invertMe) {
StringBuilder output = new StringBuilder();
for (int i=invertMe.length(); i>0; i--) {
output.append(invertMe.charAt(i-1));
}
return output.toString();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment