I realize i’m not returning my tempPoints to anything but what can I do to fix this?

Right now it sorts correctly, but when it sorts the next tier of halves they remain unsorted.

UNSORTED POINTS:

(-2, -42)

(-15, 2)

(32, 8)

(-26, 21)

(39, -42)

(-40, -18)

(-30, 7)

(-12, -28)

(19, -16)

(-16, -38)

SORTED POINTS :

(-2, -42)

(-15, 2)

(32, 8)

(-26, 21)

(39, -42)

(-40, -18)

(-30, 7)

(-12, -28)

(19, -16)

(-16, -38)

If i step through my program using the debugger, I can see it sorting each partition correctly but it doesn’t carry over to the next merge.

```
private void mergeSortRec(Point[] pts)
{
int middle = pts.length / 2;
if( pts.length ==1)
{
return;
}
Point[] left = new Point[middle];
Point[] right = new Point[pts.length - middle];
for(int i = 0; i < middle; i++)
left[i] = pts[i];
for( int j = 0; j < pts.length - middle; j++ )
right[j] = pts[middle+j];
mergeSortRec(left);
mergeSortRec(right);
merge(left, right);
}
private Point[] merge(Point[] left, Point[] right)
{
int x = 0;
int i = 0;
int j = 0;
Point[] tempPoints = new Point[(left.length) + (right.length)];
while( i < left.length || j < right.length )
{
if( i < left.length && j < right.length)
{
if( pointComparator.compare(left[i], right[j]) == -1 )
{
tempPoints[x] = left[i];
x++;
i++;
}
else
{
tempPoints[x] = right[j];
x++;
j++;
}
}
else if (i == left.length)
{
tempPoints[x] = right[j];
x++;
j++;
}
else if( j == right.length)
{
tempPoints[x] = left[i];
x++;
i++;
}
}
return tempPoints;
}
```