Toss a Coin 10,000 times:

Find the probability of getting HEAD in tossing a coin 10,000 times.
Print the answer with a description.

You are requested to use a computer to simulate a process of tossing a coin 10,000 times.

Assume that 0 is the tail of a coin and 1 is the head of a coin.
Use random method in JAVA to randomly generate 0 or 1 as tail or head.

The steps of solving this assignment is followed.

First, you have to include the utilities package in your program as below.
import java.util.Random;

Second, make a random number object by the following:
Random generator = new Random();

Third, understand that the int nextInt(int n) method returns an integer between [0, n).
For example, generator.nextInt(2) will return either 0 or 1.

Fourth, count the times of 1 appeared and record it in a memory box, numOfHeads.

Finally, calculate the probability of getting HEADs (numOfHeads / 10000.0)
and print the result.  Note that your answer should be between 0 and 1.