import java.util.Arrays;

public class test {
    public static void main(String args[]) {
        int start = 0;
        try {
            if (args.length > 0) start = Integer.parseInt(args[0]);
        } catch (Exception e) {
            throw new Error("Can't parse parameter: " + args[0]);
        }
        for (int i = start; i < 1000; i++) {
            test(i);
        }
    }

    private static void test(int size) {
        boolean result = false;
        byte array1[] = new byte[size];
        byte array2[] = new byte[size];
        for (int index = 0; index <= size; index++) {
            System.out.println("CHECKING size=" + size + " @ index = " + index);
            if (index != size) array1[index] = (byte) 1;
            for (int i = 0; i < 1000000; i++) {
                result &= testMethod(array1, array2);
            }
            result = testMethod(array1, array2);
            if (result != (index == size))
                throw new Error("Unexpected result");
            if (index != size) array1[index] = (byte) 0;
        }
    }

    private static boolean testMethod(byte[] a1, byte[] a2) {
        return Arrays.equals(a1, a2);
    }
}
