public int GetNumFromInts(ArrayList<Integer> ints, int currentnum) {
        Iterator<Integer> iter = ints.iterator();
        String str = String.valueOf(currentnum);

        for (int i = 0, j = 0, size = str.length(); i < 4 - size; i++) {
            str = j + str;
        }

        int a = Integer.valueOf(str.substring(0, 1));
        int b = Integer.valueOf(str.substring(1, 2));
        int c = Integer.valueOf(str.substring(2, 3));
        int d = Integer.valueOf(str.substring(3, 4));
        int newnum = 0;
        while (iter.hasNext()) {
            newnum = iter.next();
            if (a == newnum || b == newnum || c == newnum || d == newnum) {
            } else {
                break;
            }
        }
        return newnum;
    }