I would like to know that as I am learning Java from tutorials and there is a program for rolling the dice 1000 times and printing its frequency.

```java
import java.util.Random;
public class RollDicewitharray {

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

        System.out.println("diceNo.\tFrequency");
        for (int roll = 1; roll < 1000; roll++) {

            ++arr[1+r.nextInt(6)];                  /* this line */

        }
        for (int i = 1; i < arr.length; i++) {
            System.out.println(i+"\t"+arr[i]);
        }

    }

```