Something Wrong with QuickSort algorithm : <p>Quick Sort Java Implementation-
I have made a program to implement QuickSort algorithm, but it is not showing the sorted sequence properly, It is also showing array out of bound Index exception. can someone tell what is wrong with code or logic?</p>

<pre><code>import java.util.*;

public class QuickSort{
    int num,arrayQS[],i;

    public void quicksort(int ar[],int start,int end){
        if(start&lt;end){
            int pindex=partition(ar,start,end);
            System.out.println(pindex);
            quicksort(ar,start,pindex-1);
            quicksort(ar,pindex+1,end);
        }
    }
    public int partition(int pAR[],int start, int end){ //partition function

        int key;
        int swapper;
        int pivot=pAR[end];
        int pIndex=start;
        for(i=0;i&lt;end;i++){
            if(pAR[i]&lt;=pivot){
                //swapiing
                key=pAR[pIndex];
                pAR[pIndex]=pAR[i];
                pAR[i]=key;
                pIndex++;
            }
        }
        //swap
        swapper=pAR[pIndex];
        pAR[pIndex]=pAR[end];
        pAR[end]=swapper;
        return pIndex;
    }
    public void arrayInputFn(){
        Scanner in=new Scanner(System.in);
        System.out.println("enter the number you want to insert in an array");
        num=in.nextInt();
        arrayQS=new int[num];
        System.out.println("enter the elements in an array: ");
        for(i=0;i&lt;num;i++){
            arrayQS[i]=in.nextInt();
        }
        quicksort(arrayQS,0,arrayQS.length-1);

        for(i=0;i&lt;arrayQS.length;i++){
            System.out.print(arrayQS[i]);
        }
    }
    public static void main(String[] args){
        QuickSort qs=new QuickSort();
        qs.arrayInputFn();
    }
}
</code></pre>
