Ordenar una matriz de cierto índice Java

import java.util.Arrays;
 
public class Example2 {
    public static void main(String[] args) {
        int arr[] = {2, 14, 5, 8, 7, 9, 0};
        int fromIndex = 1;
        int toIndex = 4;
        Arrays.sort(arr, fromIndex, toIndex);
        System.out.println(Arrays.toString(arr));
    }
}
Deepak jha