Java Reflection Java Java API
java.lang.reflect.Array
public static void setFloat(Object array, int index, float f) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
Sets the value of the indexed component of the specified array object to the specified float value.
float
package com.logicbig.example.array;import java.lang.reflect.Array;import java.util.Arrays;public class SetFloatExample { public static void main(String... args) { Object o = Array.newInstance(float.class, 3); for (int i = 0; i < 3; i++) { Array.setFloat(o, i, i*3); } System.out.println(Arrays.toString((float[]) o)); }}
[0.0, 3.0, 6.0]