Попробуйте следующее l oop:
String str = "abc*d*ef*xyz*";
char nextReplace = '<';
for(int i=0; i<str.length(); i++) {
boolean find = false;
if(str.charAt(i) == '*') {
find = true;
str = str.substring(0, i) +nextReplace +str.substring(i+1);
}
if(find) {
if(nextReplace == '<') {
nextReplace = '>';
}else {
nextReplace = '<';
}
}
}
System.out.println(str);