Korzystanie z pętli do wyszukiwania wejściowej Java

import java.util.Scanner;

public class Sample {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String names[] = { "Jasmine", "Lyka", "Marbie", "Efren", "Tiny", "Soleen" };
        System.out.print("Enter a name to search:");
        String search = input.nextLine();
        for (int i = 0; i < names.length; i++) {
            if (names[i].equalsIgnoreCase(search)) {
                System.out.println("We found " + names[i]);
                break;
            }
        }
        input.close();
    }
}
Fernandez, Jasmine M.