Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.