Вывод соответствует условию, но валидатору что-то не нравится
package com.javarush.task.pro.task09.task0921;
/*
Пиратский разворот
*/
import java.util.Arrays;
public class NimrodAi {
public static void main(String[] args) {
PastryLoader[] pastryLoaders = new PastryLoader[]{new PastryLoader(), new PastryLoader(), new PastryLoader()};
scanMemory(pastryLoaders);
replaceTarget(pastryLoaders);
scanMemory(pastryLoaders);
}
public static void scanMemory(PastryLoader[] pastryLoaders) {
System.out.println();
for (PastryLoader pastryLoader : pastryLoaders) {
System.out.println(Arrays.deepToString(pastryLoader.memory));
}
}
public static void replaceTarget(PastryLoader[] pastryLoaders) {
//напишите тут ваш код
for (int h=0; h<pastryLoaders.length; h++) {
for (int i=0; i<pastryLoaders[h].memory.length; i++) {
for (int j=0; j<pastryLoaders[h].memory[i].length; j++) {
for (int k=0; k<pastryLoaders[h].memory[i][j].length; k++) {
String str = pastryLoaders[h].memory[i][j][k].toLowerCase();
str = str.replace("nimrod","pirate ship");
pastryLoaders[h].memory[i][j][k] = str;
}
}
}
}
}
}