почему не проходит 5 пункт?
package com.javarush.task.task19.task1907;
import java.io.*;
/*
Считаем слово
C:\Users\MAX\Pictures\part1.txt
*/
public class Solution {
public static void main(String[] args) {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
FileReader fileReader = new FileReader(reader.readLine())) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
for (int i = 0; i < 5; i++) {
int oneByte = fileReader.read();
if (oneByte == -1) {
System.out.println(0);
break;
} else {
byteArrayOutputStream.write(oneByte);
}
}
if (byteArrayOutputStream.size() < 5) {
return;
}
int result = 0;
StringBuilder currentWord = new StringBuilder(byteArrayOutputStream.toString());
byteArrayOutputStream.reset();
while (fileReader.ready()) {
if (currentWord.toString().equals("world")) {
result++;
}
currentWord.append((char) fileReader.read());
currentWord.deleteCharAt(0);
}
if (currentWord.toString().equals("world")) {
result++;
}
System.out.println(result);
} catch (IOException ioe){
}
}
}