For this Question: Given an array A[] and a range [a, b]. The task is to partition the array around the range such that array is divided into three parts.
1) All elements smaller than a come first.
2) All elements in range a to b come next.
3) All elements greater than b appear in the end.
The individual elements of three sets can appear in any order. You are required to return the modified arranged array.

<b>Note:-</b> 
In the case of custom input, you will get 1 if your code is correct else get a 0.<b>User Task:</b>
Since this is a functional problem you don't have to worry about the input. You just have to complete the function <b>threeWayPartition()</b> which contains following arguments.

A: input array list
low: starting integer of range
high: ending integer of range

<b>Constraints:</b>
1 <= T <= 100
1 <= N <= 10<sup>4</sup>
1 <= A[i] <= 10<sup>5</sup>
1 <= low <= high <= 10<sup>5</sup>

The Sum of N over all test case doesn't exceed 10^5For each test case return the modified array.Sample Input:
2
5
1 8 3 3 4
3 5
3
1 2 3
1 3

Sample Output:
1 3 3 4 8
1 2 3

<b>Explanation:</b>
Testcase 1: First, the array has elements less than or equal to 3. Then, elements between 3 and 5. And, finally elements greater than 5. So, one of the possible outputs is 1 3 3 4 8.
Testcase 2: First, the array has elements less than or equal to 1. Then, elements between 1 and 3. And, finally elements greater than 3. So, the output is 1 2 3., I have written this Solution Code: 
public  static ArrayList<Integer> threeWayPartition(ArrayList<Integer> A, int lowVal, int highVal)
	{
		int n = A.size();
		ArrayList<Integer> arr = A;
		int start = 0, end = n-1;
		for (int i=0; i<=end;)
		{
		    // swapping the element with those at start 
            // if array element is less than lowVal
			if (arr.get(i) < lowVal){
				int temp=arr.get(i);
				arr.add(i,arr.get(start));
				arr.remove(i+1);
				arr.add(start,temp);
				arr.remove(start+1);
				i++;
				start++;
			}
			
			// swapping the element with those at end
            // if array element is greater than highVal
			else if (arr.get(i) > highVal){
				int temp=arr.get(i);
				arr.add(i,arr.get(end));
				arr.remove(i+1);
				arr.add(end,temp);
				arr.remove(end+1);
				end--;
			}
			
			// else just move ahead
			else
				i++;
		}
		return arr;
	}
, In this Programming Language: Java, Now tell me if this Code is compilable or not?