Arrays.sort(float[] a, int fromIndex, int toIndex) has the following syntax.
public static void sort(float[] a, int fromIndex, int toIndex)
In the following code shows how to use Arrays.sort(float[] a, int fromIndex, int toIndex) method.
// w w w. ja v a2 s. com import java.util.Arrays; public class Main { public static void main(String[] args) { // initializing unsorted float array float fArr[] = {13.1f, 1.4f, 0.7f, 1.5f, 8.7f}; System.out.println(Arrays.toString(fArr)); // sorting array from index 0 to 3 Arrays.sort(fArr, 0, 3); System.out.println(Arrays.toString(fArr)); } }
The code above generates the following result.