Here is my code, it works for finding 1-7 smallest integers, but 8 and 9. It returns null when I find 8 smallest integer in the array. Can anyone help me where is the problem? I am using quicksort here.
Thanks very much!

update: I have figured out the problem, which is the array in the main function. After I change to the following look, 

```
int[] arr = {2, 3, 1, 7, 5, 6, 20, 8, 4, 9};

```

and 

```
if(front>=end) return input;

```

It works now!

```
import java.util.Arrays;
import java.io.*;

class quicksort{
public static void main(String[] args){
    int[] arr = new int[9];
    arr[0] = 7;
    arr[1] = 2;
    arr[2] = 4;
    arr[3] = 8;
    arr[4] = 3;
    arr[5] = 5;
    arr[6] = 1;
    arr[7] = 0;
    arr[8] = 10;

    System.out.println((Arrays.toString(findKSamllest(arr,8))));
}
public static int partition(int[] input, int front, int end){
    int pivot = input[front];
    while(front < end){
        while(input[front]<pivot)
            front++;
        while(input[end]>pivot)
            end--;
        swap(input,front,end);
    }
    return front;
}
public static void swap(int[] input, int s, int l){
    int temp = input[s];
    input[s] = input[l];
    input[l] = temp;
}

public static int[] findK(int[] input, int front, int end, int k){
    if(front>=end) return null;
    int pivot = partition(input,front,end);
    //System.out.println(pivot);
    if(k==pivot){
        return Arrays.copyOfRange(input,0,pivot);
    }
    else {
        if(k<pivot) 
            return findK(input,front,pivot,k); 
        return findK(input,pivot+1,end,k);
    }
}
public static int[] findKSamllest(int[] input, int k){
    return findK(input, 0, input.length-1, k);
}

```

}