Q:

I have a array with no fixed array size ,consider it might have {9,10,11,15,16...}

How can i get value value 11 and 15 because there is a missing values 12,13,14.I have got snippet from this SO post:
I could not use it for array with no fixed size.
       int binaryValue[] = null;
       ArrayList<Integer> al; 

        Vector father = new Vector();
        Vector child;
        int start = al.get(0);
          for(int i = 0; i < al.size(); i++) {
         if(al.get(i) != i + start) {
         child = new Vector();
         child.add(al.get(i-1));
         child.add(al.get(i));
         father.add(child);
    }
    }
Child should have 11 and 15 and so on ....

A:

This is pure logic based issue, you just need to look for next element to find the gap, see below working sample:
public class GapFinder {
    private static int[] myIntArr = {9, 10, 11, 12, 13, 15};

    public static void main(String[] args) {
        int a = 0,b = 0;
        for (int i = 0; i < myIntArr.length; i++) {
            if(((i + 1) < myIntArr.length) && myIntArr[i] != myIntArr[i + 1] - 1) {
                a = myIntArr[i];
                b = myIntArr[i + 1];
                break;
            }
        }
        if(a == 0 && b == 0){
            System.out.println("There were no gaps.");
        } else{
            System.out.println("Gaps: " + a + " | " + b);
        }
    }
}

Please note: 

This is not a concept which I could possibly explain, this is pure logic and I have said this in my opening statement, and logic is also straight forward which needs no explaination, its quiet implicit and not a complex algorithmic logic; OP just needed to loop for next element to identify the gap, until next/previous element is checked, a gap cannot be identified with getting expected values, this was just a small step OP was missing and OP got it
This is a working solution, there could be corner cases like what @9000 mentioned in his comment, it is basic assumption that I cannot provide answer handling all corner cases, I am just highlighting the logic which would help solve the problem.

