Arrays.fill(float[] a, int fromIndex, int toIndex, float val) has the following syntax.
public static void fill(float[] a, int fromIndex, int toIndex, float val)
In the following code shows how to use Arrays.fill(float[] a, int fromIndex, int toIndex, float val) method.
/* w w w. j a v a 2 s. c om*/ import java.util.Arrays; public class Main { public static void main(String[] args) { float arr[] = new float[] {1f, 2f, 3f, 4f, 5f}; System.out.println(Arrays.toString(arr)); // using fill for placing 12 from index 1 to 3 Arrays.fill(arr, 1, 3, 12f); System.out.println(Arrays.toString(arr)); } }
The code above generates the following result.