Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
package ch.salt.code.challenge;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
public class CodeChallenge
{
public static String treatString(final String str) {
final int length = str.length();
final List<Character> charList = new ArrayList<Character>(str.length());
for (int zIndex = -1; zIndex < length - 1; ++zIndex) {
charList.add(str.charAt(zIndex + 1));
}
final List<Character> charList2 = new LinkedList<Character>();
int z2Index = -2;
final int value = 8;
final int res = value % 3;
while (z2Index < length - 2) {
charList2.add(charList2.size(), charList.get(z2Index + res));
z2Index++;
}
final char[] array = new char[length];
for (int i = 0; i < length; ++i) {
array[length - i - 1] = charList2.get(i);
}
return new String(array);
}
}
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.