I am working on a linear search problem that takes a file of names and compares it to a phonebook file of names and numbers. My only task right now is to see how many names are in the phonebook file. Everything works as expected up until the if statement in my main method, but for the life of me, I cannot figure out what I am doing wrong. Through testing, I can print out all the lines in both files, so I know I am reading the files correctly. Output should be 500 / 500 as all the names are in the phonebook file of over a million lines. Please help.

```
package phonebook;

import java.util.Objects;
import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;

public class Main {
    final static String NAME_PATH = "C:\\Users\\{user}\\Downloads\\find.txt";
    final static String PHONEBOOK_PATH = "C:\\Users\\{user}\\Downloads\\directory.txt";

    private static String[] namesList(File file) {
        int count = 0;
        try (Scanner scanner = new Scanner(file)) {
            while (scanner.hasNextLine()) {
                scanner.nextLine();
                count++;
            }
            String[] names = new String[count];
            Scanner sc = new Scanner(file);
            for (int i = 0; i < count; i++) {
                names[i] = sc.nextLine();
            }
            return names;
        } catch (FileNotFoundException e) {
            System.out.printf("File not found: %s", NAME_PATH);
            return null;
        }
    }

    private static String timeDifference(long timeStart, long timeEnd) {
        long difference = timeEnd - timeStart;
        long minutes = (difference / 1000) / 60;
        long seconds = (difference / 1000) % 60;
        long milliseconds = difference - ((minutes * 60000) + (seconds * 1000));
        return "Time taken: " + minutes + " min. " + seconds + " sec. " +
                milliseconds + " ms.";
    }

    public static void main(String[] args) {
        File findFile = new File(NAME_PATH);
        File directoryFile = new File(PHONEBOOK_PATH);
        String[] names = namesList(findFile);
        int count = 0;
        try (Scanner scanner = new Scanner(directoryFile)) {
            System.out.println("Start searching...");
            long timeStart = System.currentTimeMillis();
            for (int i = 0; i < Objects.requireNonNull(names).length; i++) {
                while (scanner.hasNextLine()) {
                    if (scanner.nextLine().contains(names[i])) {
                        count++;
                        break;
                    }
                }
            }
            long timeEnd = System.currentTimeMillis();
            System.out.print("Found " + count + " / " + names.length + " entries. " +
                    timeDifference(timeStart, timeEnd));
        } catch (FileNotFoundException e) {
            System.out.printf("File not found: %s", PHONEBOOK_PATH);
        }
    }
}

```

Output:

```
Start searching...
Found 1 / 500 entries. Time taken: 0 min. 0 sec. 653 ms.
Process finished with exit code 0

```