Look at your code, you tell it to create a random number between 0 and 9. In the Random class however, the generated number is between 0 and n inclusive meaning the any number between 0 - (n-1) is generated. Look at all the generated numbers above, they may have nine digits, but none of them have a a nine in the digits.
Also, the small percentage that are 8 digits are going to happen unless you add a check. Let's do some math:
probability of first value equaling ten:
1 value looked for
9 possible
probability is 1/9 or 11.1(...)% of the time.
*(...) means repeating
first two values are zero:
(1/9)*(1/9) or (1/9)^2
1/81 or 1.23456780(...)% of the time.
all 9 equal zero:
(1/9)^9
1/387,420,489 or (2.5811747917131971819900315081167532159095488622957161153... × 10^-7) percent.
So basically, if you run the algorithm 387,420,489 times, you will probably have this number "000000000" be result. But since you generate numbers without a repeating value, you will have an 8 digit number (leading zero) about 11% of the time. If you don't want zeros in your generated values, you can do this, which creates a value between one and nine:
Random random = new Random();
int val =random.nextInt(9) + 1;
Or
If you want to avoid the first value being zero, when you generate the first number, there are a few ways to do it.
Random rand = new Random();
//method 1
int val = 0;
do{
val = rand.nextInt(10);
}while(val!=0);
//method 2
val = rand.nextInt(9)+1;