Substitua a substring no índice java
public static void main(String[] args) {
StringBuffer buf = new StringBuffer("123456789");
int start = 3;
int end = 6;
buf.replace(start, end, "foobar");
System.out.println(buf);
}
}
SharxNZ