public void combination(int input[],int result[],int k,int pos,int r){
        
        if(pos == input.length){
            for(int i=0; i < r ; i++){
                System.out.print(result[i] + " ");
            }
            System.out.println();
            return;
        }
        for(int i=pos; i < pos + k && i < input.length; i++ ){
            result[r] = formNumber(input,pos,i);
            combination(input,result,k,i+1,r+1);
        }
    }
Generate all combination of size k and less of adjacent numbers
e.g 1,2,3,4 k = 2
1 2 3 4
12 3 4
1 23 4
1 2 3 34
12 34
@author tusroy
src/com/interview/recursion/AllAdjacentCombination.java