//: arrays/TestArrayGeneration.java // Test the tools that use generators to fill arrays. import java.util.*; import net.mindview.util.*; import static net.mindview.util.Print.*; public class TestArrayGeneration { public static void main(String[] args) { int size = 6; boolean[] a1 = ConvertTo.primitive(Generated.array( Boolean.class, new RandomGenerator.Boolean(), size)); print("a1 = " + Arrays.toString(a1)); byte[] a2 = ConvertTo.primitive(Generated.array( Byte.class, new RandomGenerator.Byte(), size)); print("a2 = " + Arrays.toString(a2)); char[] a3 = ConvertTo.primitive(Generated.array( Character.class, new RandomGenerator.Character(), size)); print("a3 = " + Arrays.toString(a3)); short[] a4 = ConvertTo.primitive(Generated.array( Short.class, new RandomGenerator.Short(), size)); print("a4 = " + Arrays.toString(a4)); int[] a5 = ConvertTo.primitive(Generated.array( Integer.class, new RandomGenerator.Integer(), size)); print("a5 = " + Arrays.toString(a5)); long[] a6 = ConvertTo.primitive(Generated.array( Long.class, new RandomGenerator.Long(), size)); print("a6 = " + Arrays.toString(a6)); float[] a7 = ConvertTo.primitive(Generated.array( Float.class, new RandomGenerator.Float(), size)); print("a7 = " + Arrays.toString(a7)); double[] a8 = ConvertTo.primitive(Generated.array( Double.class, new RandomGenerator.Double(), size)); print("a8 = " + Arrays.toString(a8)); } } /* Output: a1 = [true, false, true, false, false, true] a2 = [104, -79, -76, 126, 33, -64] a3 = [Z, n, T, c, Q, r] a4 = [-13408, 22612, 15401, 15161, -28466, -12603] a5 = [7704, 7383, 7706, 575, 8410, 6342] a6 = [7674, 8804, 8950, 7826, 4322, 896] a7 = [0.01, 0.2, 0.4, 0.79, 0.27, 0.45] a8 = [0.16, 0.87, 0.7, 0.66, 0.87, 0.59] *///:~