In This Question A value is "everywhere" in an array if for every pair of adjacent elements in the array, at least one of the pair is that value. Return true if the given value is everywhere in the array. 

`isEverywhere({1, 2, 1, 3}, 1) → true,coz 1 is present in(1,2) and (1,3)`
`isEverywhere({1, 2, 1, 3}, 2) → false,coz 2 is in (1,2) but not in (1,3)`
`isEverywhere({1, 2, 1, 3, 4}, 1) → false,coz 1 is present in 2 pairs (1,2) and (1,3) but 4 is not having a pair of 1`

My Partial working code is below,could you help me out with this problem,stuck up for a long time.

**::Code::**

```
public boolean isEverywhere(int[] nums, int val) {    
    boolean flag = false;    
    for(int i=0;i<nums.length;i++){    
      for(int j=i+2;j<nums.length;j++){    
            if(nums[i] == nums[j]){    
                 flag = true;    
            }    
      }    
    }      
  return flag;     
}         

```

Result expected:

```
                           `Expected` `This` `Run`       

```

`isEverywhere({1, 2, 1, 3}, 1) → true true OK`  

`isEverywhere({1, 2, 1, 3}, 2) → false true X`  

`isEverywhere({1, 2, 1, 3, 4}, 1) → false true X`