Quick Sort (getting exception error)

When i am running this code in eclipse it is running fine. While running here it is showing arrayoutof bounds exception:

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();

    int[] arr = new int[n];

    for(int i=0;i<n;i++){
        arr[i] = sc.nextInt();
    }

    sort(arr, 0, n-1);
    printArray(arr);
}

static void sort(int[] arr, int l, int h){
    if(l<h){
        int pi = partition(arr,l,h);
        sort(arr,l,pi-1);
        sort(arr,pi+1,h);
    }
}

static int partition(int[] arr, int l, int h){
    int pivot = arr[h];

    int i=l-1;
    for(int j =0; j<h; j++){
       if(arr[j]<=pivot) {
				i++;
				int temp = arr[i];
				arr[i] = arr[j];
				arr[j] = temp;
		}
    }
    int temp = arr[i+1];
			arr[i+1] = arr[h];
			arr[h] = temp;
		
	return i+1;
}

static void printArray(int arr[]) 
{ 
    int n = arr.length; 
    for (int i=0; i<n; i++) 
        System.out.print(arr[i]+" "); 
    System.out.println(); 
} 

}

Hi Anjali,
Your partition function gives index Out of Bounds because You are always starting Partitioning from 0th index.
Make required changes in your Partition function and then revert back.