答案 0 :(得分:1)
class NewLiner {
public static void main(String[] args) {
String test = "0 2 4 6 8 10";
char[] cs = test.toCharArray();
int step = 10;
int count = (int) (cs.length / step);
int limit = count * step + 1;
for (int i = step - 1; i < limit; i+= step) {
if (Character.isWhitespace(cs[i])) {
cs[i] = '\n';
}
}
System.out.println(new String(cs));
}
}