private boolean binarySearch(int arr[],int start,int end,int num){
        if(start > end){
            return false;
        }
        int mid = (start + end)/2;
        if(arr[mid] == num){
            return true;
        }
        else if(arr[mid] > num){
            return binarySearch(arr,start,mid-1,num);
        }else{
            return binarySearch(arr,mid+1,end,num);
        }
    }
http://www.geeksforgeeks.org/count-pairs-difference-equal-k/
src/com/interview/binarysearch/CountNDistinctPairsWithDifferenceK.java