// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
public class SequenceSearchBasic {
    public static boolean contains(int[] list1, int[] list2) {
        for(int i = 0; i < list1.length - list2.length + 1; i++) {
            boolean allmatch = true;
            for(int j = 0; j < list2.length; j++) {
                if(list1[i + j] != list2[j]) {
                    allmatch = false;
                }
            }
            if(allmatch) {
                return true;
            }
        }
        return false;
    }
    public static void main(String[] args) {
        int[] list1 = {1, 6, 2, 1, 4, 1, 2, 1, 8};
        int[] list2 = {1, 2, 1};
        int[] list3 = {1, 2, 8};
        System.out.println(contains(list1, list2));
        System.out.println(contains(list1, list3));
    }
}
