import java.util.Random;
public class apples {

public static void main(String args[]){
Random rand= new Random();
int freq[]=new int[7];

for(int roll=1;roll<1000;roll++){
int index = 1+rand.nextInt(6);
int f = freq[index];
++f;
freq[index] = f;
}

System.out.println("Face \tFrequency");

for(int face=1;face<freq.length;face++){
System.out.println(face+"       "+freq[face]);
}
}
}

Please can someone explain the first (for loop)of the program...with an appropriate example will be really helpful.
Thank You.