import java.util.Arrays;


public class ArraysFill {
	public static void main(String[] args) {
		int size = 10000;
		float[] f = new float[size];
		int big = 100000;		

		for(int k = 0; k < 10; k++)
		{		
			long time = System.currentTimeMillis();
			for(int i = 0; i < big; i++) {
				float x =(float) Math.random();
				Arrays.fill(f, x);
			}
			System.out.print(System.currentTimeMillis() - time);
			System.out.print(" ");


			time = System.currentTimeMillis();
			for(int i = 0; i < big; i++) {
				float x =(float) Math.random();
				Arrays.fill(f, x);
			}
			System.out.print(System.currentTimeMillis() - time);
			System.out.print(" ");


			time = System.currentTimeMillis();
			for(int i = 0; i < big; i++) {
				float x =(float) Math.random();
				for(int j = 0; j < size; j++) {
					f[j] = x;
				}
			}
			System.out.println(System.currentTimeMillis() - time);

		}
	}

}
